手记

Message Authentication Code 验证码

<!--提交菜单-->
<?php
    if(isset($_REQUEST['authcode'])){
    session_start();
    if($_REQUEST['authcode']==$_SESSION['authcode']){
        echo "输入正确";    
    }
    else{
        echo "输入错误";
    }
    exit();
    }
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8||GBK">
    <title>验证码的实现</title>
</head>
<body>
    <form name="form" action="./form.php"method='post'>
    <table>
    <tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
            <td>验&nbsp;证&nbsp;码:&nbsp;&nbsp;&nbsp;<img border="1"src="./captcha.php? r=<?php echo rand();?>"width="160px" height="25px"></td>
        </td>
    </tr>
    <tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
            <td>请输入图片的内容:<input name="text"type="text"value=""/></td>
        </td>
    </tr>   
    </tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
        <td><input name="submit"type="submit"value="提交"></td>
    </td>
    </tr></table>
    </form>
</body>
</html>

<!--form菜单-->
<?php
    if(isset($_REQUEST['authcode'])){
    session_start();
    if($_REQUEST['authcode']==$_SESSION['authcode']){
        echo "输入正确";    
    }
    else{
        echo "输入错误";
    }
    exit();
    }
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8||GBK">
    <title>验证码的实现</title>
</head>
<body>
    <form name="form" action="./form.php"method='post'>
    <table>
    <tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
            <td>验&nbsp;证&nbsp;码:&nbsp;&nbsp;&nbsp;<img border="1"src="./captcha.php? r=<?php echo rand();?>"width="160px" height="25px"></td>
        </td>
    </tr>
    <tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
            <td>请输入图片的内容:<input name="text"type="text"value=""/></td>
        </td>
    </tr>   
    </tr>
        <td width="200" height="50"cellspacing="0" cellpadding="0"border="1">
        <td><input name="submit"type="submit"value="提交"></td>
    </td>
    </tr></table>
    </form>
</body>
</html>
0人推荐
随时随地看视频
慕课网APP