分享

session的例子

 yliu277 2015-04-13
 < ? //引入文件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 >  

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约