< ? //引入文件config.inc.php,准备使用变量$USER和 $PASSWORD include "config.inc.php"; //注册一个session变量userpassword session_register("userpassword"); if ($user1==$USER and $password1==$PASSWORD){ //判断登录的用户ID和PASSWORD是否正确 $userpassword=$user1.$password1; //假如正确就把ID和PASSWROD合并后的 //值保存到session变量$userpassword, header ("Location: index.php"); //并跳转到测试页index.php, exit(); //否则就停留在登录页login.php。 } ? > < HTML > < HEAD > < title >登录页< /title > < /HEAD > < BODY > < form method="POST" action="" > < div align="center" >< center > < table border="0" width="55%" height="153" > < tr > < td width="100%" align="center" height="47" > 管理员账号:< input type="text" name="user1" size="20" value="" >< /td > < /tr > < tr > < td width="100%" align="center" height="43" > 管理员密码:< input type="password" name="password1" size="20" value="" >< /td > < /tr > < tr > < td width="100%" align="center" height="51" > < input type="submit" value="登录" name="ok" class=wdBlack > < input type="reset" value="清除" name="B2" class=wdBlack >< /td > < /tr > < /table > < /center >< /div > < /form > < /body > < /html > |
|