/哪位大哥帮我调试一下,我出现的问题是输入正确的验证码,仍然提示错误
//che.php
<?
session_start();
$_SESSION[check_pic]=$rand;
for($i=0;$i<4;$i++){
$rand.=dechex(rand(1,15));
}$im=imagecreatetruecolor(100,30);
$bg=imagecolorallocate($im,0,0,0);
$te=imagecolorallocate($im,255,255,255);
imagestring($im,rand(1,6),rand(3,70),0,$rand,$te);header("content-type:image/jpeg");
imagejpeg($im);?>
//sub.php
<?
session_start();
if($_POST[check]){
if($_POST[check]==$_SESSION[check_pic]){
echo "验证码正确".$_SESSION[check_pic];
}
else{
echo "验证码错误".$_SESSION[check_pic];
}
}
?>
<form action="" method="post" >
<img src='che.php'><br> <input type="text" name="check"><br> <input type="submit" value="提交"/><br>
</form>
//che.php
<?
session_start();
$_SESSION[check_pic]=$rand;
for($i=0;$i<4;$i++){
$rand.=dechex(rand(1,15));
}$im=imagecreatetruecolor(100,30);
$bg=imagecolorallocate($im,0,0,0);
$te=imagecolorallocate($im,255,255,255);
imagestring($im,rand(1,6),rand(3,70),0,$rand,$te);header("content-type:image/jpeg");
imagejpeg($im);?>
//sub.php
<?
session_start();
if($_POST[check]){
if($_POST[check]==$_SESSION[check_pic]){
echo "验证码正确".$_SESSION[check_pic];
}
else{
echo "验证码错误".$_SESSION[check_pic];
}
}
?>
<form action="" method="post" >
<img src='che.php'><br> <input type="text" name="check"><br> <input type="submit" value="提交"/><br>
</form>
$rand = '';
for($i=0;$i <4;$i++){
$rand.=dechex(rand(1,15));
}
$_SESSION['check_pic']=$rand;