About CAPTCHA Issues
Always get the value you don't get.
So it's always impossible to judge session_id correctly.
Other people's browser problem is no problem, that is, my machine has a problem.
Later this time changed the new host, the new system, the problem arose again, collapsed.
Don't know what the reason is?
PHP Generate Verification Code myauth.php
PHP Code
Class auth{Public Function auth () {session_start (); Start session $str = "abcdefghijkmnpqrstuvwxyz23456789"; /* Generate a 4-bit random number */for ($i =0; $i <4; $i + +) {$num. =SUBSTR ($str, Rand (0,29), 1 ); } $_session[' code ']= $num; Save the random number to the session $im =imagecreate (60,25); Create a 60*20 image $white =imagecolorallocate ($im, 255,255,255); Set the background color of the image to white $blue =imagecolorallocate ($im, 0,0,255); Set the text color in the image to blue/* Add multiple Color * numbers to the image */for ($i =1; $i <200; $i + +) { $x =rand (1,60-9); $y =rand (1,20-6); $color =imagecolorallocate ($im, Rand (200,255), Rand (200,255), Rand (200,255)); Imagechar ($im, 1, $x, $y, "*", $color); }/* Adds a 4-bit random number to the image and adds a position that is not fixed */$strx =rand (3,8); for ($i =0; $i <4; $i + +) {$strpos =rand (1,6); Imagestring ($im, 5, $strx, $strpos, substr ($num, $i, 1), $blue); $strx +=rand (8,12); } header ("Content-type:image/gif"); Sets the format of the output image imagegif ($im); Output Image Imagedestroy ($im); Release image resources//return $_session[' code '; Exit }} $auth = new Auth ();
HTML display
HTML Code
Verification Code: Click image Refresh
------Solution--------------------
If you have a problem with someone else, you should change your own system/browser. Also confirm how many other people's proportion is so clear whether it is your own system or the server code and other problems.
------Solution--------------------
Check that the Session.autostart is turned on.
------Solution--------------------
discuss
The machines are new and the system is new.
------Solution--------------------
First check to see if the Session.autostart is open.
But other people's browser is fine, that is, my machine is in trouble. That should not be the reason.
You have to check if your browser allows cookies.
The code itself is fine
If the HTML display src= "{$baseurl}/auth.php" that's obviously wrong.
That's the same thing in the template.
------Solution--------------------
And maybe this part of the path was wrongly written.
/auth.php "...;