<?php
include_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登录
<?php
include_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);
?>