require("/commonfuncs.php3");
require("home/websrc/userfuncs.php3");
function makeloginform(){
echo"Please login first<br>";
echo"<form action+";
echo $GLOBALS["PHP_SELF"];
if(!$HTTP_COOKKIE_VARS["UserID"]){
if(!$UserName){
makeloginform();
exit;
}
if(!$userinfo=getuserbyname($UserName))){
echo "Login Name Error!";
exit;
}
if($userinfo->password!=$Password){
echo "Login Password Error!";
exit;
}
$conn=DBConnect();
$sql="insert into useronline(uid,logintime,username)values(";
$sql=$sql.$userinfo->name;
$sql=$sql."@#)";
mysql_query($sql,$conn);
DBClose($conn);
if(!(setcookie("UserID",$userinfo->id,"","/"))){
echo"Set Cookie Error!!";
exit;
}
$strHeader="Location:".$PHP_SELF;
header($strHeader);
exit;
}
?>
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/