当然,防刷新的方法有很多.
搜索一下老帖.
搜索一下老帖.
解决方案 »
- 请教下。UC浏览器是不是不支持type="image"啊?
- Cannot modify header information - headers already sent by
- asp.net,jsp,php,哪个好找工作
- 小妹急需解决菜鸟问题:用php把word打印出来的代码
- 万事具备,只欠东风——PHP也装好了,mysql也装好了,就是连不是phpmyadmin。。。
- echo exec('ls /'); 怎么只得到最后一个啊
- 特别奇怪的include路径问题!!。。。。。。。。。。
- 怎么把 华南 变成 华南?
- 请问有人对cakephp了解吗?有问题请教!
- 天冷了冒个泡
- 想要空间的进来看看,我自己的服务器
- PHP中有没有这样一个函数,在线等!!
/* filename:authpage.php
*/session_start();
//验证用户输入是否和验证码一致
if (isset($_POST['authinput']))
{
if ($_SESSION['auth'] == $_POST['authinput'])
{
//验证成功
echo "验证成功!";
$_SESSION['auth'] = '';//销毁验证码
//这里写其他数据的验证代码.
//...............
///////////////////////// exit;
} else {
//验证码没有通过检测
echo "输入的验证码错误!";
//转到
}
}
?>
<form action=authpage.php method=post>
<table align=center><tr><td>请输入验证码:<input type=text name=authinput style="width: 80px"><img src=authimg.php></td></tr>
<tr><td><input type=submit name="验证" value="提交">
</td></tr>
</table>
</form>=============
<?php
// Filename: authimg.php session_start();
srand((double)microtime()*1000000); while(($authnum=rand()%10000)<1000);//生成四位随机整数验证码
$_SESSION['auth']=$authnum;//生成验证码图片
Header("Content-type: image/PNG");
$im = imagecreate(50,20);
$black = ImageColorAllocate($im, 200,10,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 230,230,230);
imagefill($im,68,30,$gray); //将四位整数验证码绘入图片
//位置交错
for ($i = 0; $i < strlen($authnum); $i++) {
if ($i%2 == 0) $top = 1;
else $top = 5;
imagestring($im, 5, 10*$i+6, $top, substr($authnum,$i,1), $black);
}for($i=0;$i<150;$i++) //加入干扰象素
{
imagesetpixel($im, rand() % 70 , rand() % 30 , $black);
} ImagePNG($im);
ImageDestroy($im);?>