/哪位大哥帮我调试一下,我出现的问题是输入正确的验证码,仍然提示错误
//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>
解决方案 »
- 如何下载php网页
- mktime这个括号里的参数什么意思啊 看不太懂也看手册了
- Zend Optimizer v2.5.10环境问题 和Apache 1.3.33 怎么设置两个端口
- php数组删除了一个数,如何让$arr被删除的后序 自动前移?
- 请问用get方式最多可以传递多少字节内容?
- 怎么win和linux下都有这个问题?请帮助我这个"php高手"吧!
- 请教:如何将别人在WEB页上提出的意见,发送到指定的邮箱?
- 文件管理(类资源管理器)
- 谁配置过百度编辑器ueditor1.4.3的图片上传路径?
- 为什么很多程序要开源?各种免费cms网上一大堆
- 请教httpd.ini的一个写法
- PHP小偷程序,如何得到这个页面中的标题,重复输出,求教了
$rand = '';
for($i=0;$i <4;$i++){
$rand.=dechex(rand(1,15));
}
$_SESSION['check_pic']=$rand;