手记

关于php验证码功能点(笔记)

<?php
header('content-type:text/html;charset=utf-8');
if(isset($_REQUEST['authcode'])){
session_start();

if(strtolower($_REQUEST['authcode']) == $_SESSION['authcode']){
    echo '<font color="#333">输入正确(yes)</font>';
}else{
    echo '<font color="red">输入错误(no)</font>';
}
exit();

}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>验证码确认</title>
</head>
<body>
<form method="post" action="./form.php">
<p>验证码图片:<img border = "1" src="./captcha.php?r=<?php echo rand();?>" /></p>
<p>请输入验证码内容:<input type="text" name="authcode" value="" /></p>
<p> <input type="submit" value="提交" style="padding: 6px 20px;" /></p>
</form>
</body>
</html>

10人推荐
随时随地看视频
慕课网APP