PHP verification code landing check

time:15-11-01 forum:PHP tools and code
  http://www.xiariboke.com/codes/326.html

verification code landing check is a very common function in PHP, in the background of the PHP site interface, the use of authentication code can prevent the malicious landing robot, if the malicious login, if PHP verification check code is placed on the registration page, which can prevent malicious users to register. The check function of PHP verification code is an indispensable function in PHP, and is also a very high use rate. As long as there are registered or landing PHP applications, there are PHP verification code landing check functions, PHP verification code source generation There are a lot of code online, and there are many PHP mature class files. The following is just how we will download the PHP verification code.

principle: generate a picture, and save the characters displayed in the picture to determine whether the input check code is the same as the SESSION check code.

this is the file checkNumber.php

[code] session_start () for generating the check code and the picture;
if (SESSION.) / > > > / > > {
Header (.Quot; Content-type: image/png.quot;);
srand (microtime () * 100000);
$login_check_number = strval; Use COOKIE
//setcookie (.Quot; login_check_number.quot; $login_check_number);
/ / / / / / / then delete the first line session_start ();
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / (0,0,0);
$c_white = ImageColorAllocate ($h_img, 255255255);
imageline ($h_img, 1, 1, 350, 25, $c_black);
imagearc ($h_img, 200, 15, 20, 20, 35, 190); />die ();
> [/code]

use method:

add.Lt in the HTML file; input type=text name=number maxlength=4.gt; Br />[code]//$number is the value of the check code you entered

include_once (.Quot;./checkNumber.php.quot;);

/ / / check code

if. .quot;);
die ();
>
* /
.Gt; [/code]
the problem of using SESSION:
if the landing page is opened after the lapse of SESSION, the landing will fail. Not.
for the VBB forum. After saving checkNumber.php. Modify the
title of the MYSQL database template data table for logincode forumhome_logincode username_loggedou
t template content. />[code] / / / test check code
include_once (.Quot;./checkNumber.php.quot;);
if ($number! = $login_check_number $number = =.Quot;.Quot;); / >} [/code]

prev:Install.php simple production next:A tomato in Ji'nan is "fine"! It's not b...
post comment
Notice



approved   Do not work to go to school and not ...   Tea table "dark words"   Bazhong man built a small wooden bri...   The army flags the banner of the fla...   The 52 year old substitute teacher s...
rand   PHP curl realizes multi process and ...   A solution to PHPCMS's login backsta...   Discuz source code analysis and plug...   Discuz! "I'm sorry, you are not inst...   JS array usage description
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com