php模拟OICQ的用户登陆部分
时间:2007-02-17 来源:PHP爱好者
1 登陆表单,请看我的主页的文本源代码吧!这里我就不多写了!!
2 login.php 用户登陆,注册 session 等工作!
<?
session_start();
session_register("name");
session_register("password");
session_register("photo");
session_register("loginsign");
session_register("level");
session_register("place");
$name=$password="";
$chatsign=$loginsign=0;
$menusave=" ";
$mysqlusername = "php2000";
$mysqlpassword = "";
$hander = mysql_connect("localhost",$mysqlusername,$mysqlpassword);
mysql_select_db("php2000");
$loginsign =0;
if(($loginname != "") && ($loginpass != ""))
{
$name = $loginname;
$password = $loginpass;
$userloginsign=1;
}
if( ($name == "") || ($password == ""))
{
$loginsign =0;
}
else
{
$msg = mysql_fetch_array($result=mysql_query("select password,level,status from userinfo where name='$name'"));
if( ( mysql_num_rows($result) == 1) && ($msg['password'] == $password) )
{
$loginsign = 1;
$level = $msg['level'];
$photo = $messageuser['face'];
$timecurrent = date("U");
if( ($lastenterdate = $messageuser['enterdate']) == 0) $lastenterdate = $timecurrent;
mysql_query("update userinfo set
ip='$ip',ipfrom='$ipfrom',onlinestatus=1,enterdate=$timecurrent,entertimes=entertimes+1,lastenterdate=$lastenterdate,currentdate=$timecurrent,chatroom='
where name = '$name'");
}
}
header("location:index.php");
?>
php2000
php爱好 者站 http://www.phpfans.net php基础|php进阶|php模板.
2 login.php 用户登陆,注册 session 等工作!
<?
session_start();
session_register("name");
session_register("password");
session_register("photo");
session_register("loginsign");
session_register("level");
session_register("place");
$name=$password="";
$chatsign=$loginsign=0;
$menusave=" ";
$mysqlusername = "php2000";
$mysqlpassword = "";
$hander = mysql_connect("localhost",$mysqlusername,$mysqlpassword);
mysql_select_db("php2000");
$loginsign =0;
if(($loginname != "") && ($loginpass != ""))
{
$name = $loginname;
$password = $loginpass;
$userloginsign=1;
}
if( ($name == "") || ($password == ""))
{
$loginsign =0;
}
else
{
$msg = mysql_fetch_array($result=mysql_query("select password,level,status from userinfo where name='$name'"));
if( ( mysql_num_rows($result) == 1) && ($msg['password'] == $password) )
{
$loginsign = 1;
$level = $msg['level'];
$photo = $messageuser['face'];
$timecurrent = date("U");
if( ($lastenterdate = $messageuser['enterdate']) == 0) $lastenterdate = $timecurrent;
mysql_query("update userinfo set
ip='$ip',ipfrom='$ipfrom',onlinestatus=1,enterdate=$timecurrent,entertimes=entertimes+1,lastenterdate=$lastenterdate,currentdate=$timecurrent,chatroom='
where name = '$name'");
}
}
header("location:index.php");
?>
php2000
php爱好 者站 http://www.phpfans.net php基础|php进阶|php模板.
相关阅读 更多 +