登录
session_start();
if (!session_is_registered('user')) {//session_is_registered是检查变量是否注册
session_register('user');
$user="";
}
if (!session_is_registered('load1')) {
session_register('load1');
$load1="";
}
?>
if($user==""){#判断是否是第一次登陆
?>
}elseif($load1=="load1"){
?>
}
?>
注册页面
用户注册
注册功能$db = mysql_connect("localhost","root","642531") ;
mysql_select_db("news",$db);
$name=$_POST['name'];
$pwd=$_POST['password'];
$pwd1=$_POST['password1'];
if($pwd!=$pwd1){
exit("密码不相等!");
}
$query="select * from user_msg where name='$name'";
$result=mysql_query($query);
if(mysql_num_rows($result)>0)
{
$temp="该用户已占用,请更换";
echo $temp;
exit();
}
$query1="insert into user_msg(name,password) values('$name','$pwd')";
$result1=mysql_query($query1);
if($result1){
echo "";
echo "";
}else{
echo"";
echo "";
}
?>
阅读(1115) | 评论(0) | 转发(0) |