码迷,mamicode.com
首页 > 其他好文 > 详细

简易用户登录设计

时间:2015-05-07 12:40:55      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:用户登录   验证码   用户名   密码   

1、login.php

<?php
function yzm(){
    $str="";
    for($i=1;$i<=4;$i++){
    $str.=rand(0,9);
    }
    return $str;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>

<form method="post" action="msg.php">
<table>
<tr>
    <td>用户名:</td>
    <td><INPUT TYPE="text" NAME="username"></td>
</tr>
<tr>
    <td>密码:</td>
    <td><INPUT TYPE="text" NAME="password"></td>
</tr>
<tr>
    <td>验证码:</td>
    <td><INPUT TYPE="text" NAME=""size=4><INPUT TYPE="button" value=‘<?php echo yzm();?>‘></td>
</tr>
<tr>
    <td></td>
    <td><INPUT TYPE="submit" name="submit" value="登录"><INPUT TYPE="reset"></td>
</tr>
</table>
</form>
</body>
</html>

2、msg.php

<?php
if(!empty($_POST[‘submit‘])){

$name=$_POST[‘username‘];
$pwd=$_POST[‘password‘];
echo "用户",$name,",你好";
}else{
    header("Location:login.php");
}
?>

本文出自 “学而不思则罔” 博客,请务必保留此出处http://dyzyxy.blog.51cto.com/944775/1643741

简易用户登录设计

标签:用户登录   验证码   用户名   密码   

原文地址:http://dyzyxy.blog.51cto.com/944775/1643741

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!