电脑安全

您当前的位置:主页 > 电脑安全 >

php登录 cookie自动登录-网络编程

来源:[db:来源]标题:   功能表    编辑:电脑技术全能网 时间:2019-09-22 12:31

原标题:php登录 cookie自动登录-网络编程
   <?phpinclude_once ("sql_connect.php");include_once ("my_msg.php"); ?> <html> <head> <meta http- equiv="content-type" content="text/html" charset=utf-8 /> <title& gt;会员功效表</title> < /head> <body bgcolor = "white" text="black" link="blue" vlink="purple" alink="red"><?php if(isset($_COOKIE['cookie_chk'])){ if($_COOKIE['cookie_chk'] !="logined"){ my_msg("登录失利,请从新登录!","login.php"); } }else { my_msg("登录失利,请从新登录!","login.php"); } ?> <h1 align="center">欢送<?php echo $_COOKIE['cookie_id']; ?>进入会员区<br> <p>会员主功效表</h1>< /p></p><h3 align="center"><a href="pass.html">修正暗码</a></h3> <h3 align="center"><a href="login.php"& gt;登记</h3> </body> </html>上面来看php登录<?phpinclude_once("sql_connect.php"); include_once("my_msg.php"); ?> <?php if($_POST['id']=='' or $_POST['passwd']==''){ my_msg("字段不能为空!","login.php");} $sqlstr ="select * from member where id='".$_POST['id']."' and passwd='".$_POST['passwd']."' and status =1";$result = mysql_query($sqlstr,$link); $row = mysql_fetch_array($result,MYSQL_BOTH);if(mysql_num_rows($result)==1 && $row["rank"]==100){setcookie("cookie_chk","adm_logined"); setcookie("cookie_id",$_POST['id']); my_header("adm.php");}elseif (mysql_num_rows($result)==1 && $row["rank"]==1){ setcookie("cookie_chk","logined"); setcookie("cookie_id",$_POST['id']); my_header("main.php"); }else { my_msg("登录失利,请从新等录!","login.php");} mysql_free_result($result);mysql_close($link); ?>

上一篇:二级联动菜单-网络编程

下一篇:没有了