时间:2021-07-01 10:21:17 帮助过:2人阅读
session_start();
class chkuserlogin{
private $username;
private $password;
public function __construct($username,$password){
$this->username=$username;
$this->password=$password;
require_once("connn.php");
$sql=mysql_query("select account from root where username='".$this->username."' and password='".$this->password."'",$conn);
$info=mysql_fetch_array($sql);
if($info==false){
echo "";
exit;
}else{
if($_SESSION["unc"]!=""){
session_unregister("unc");
}
session_register("unc");
$_SESSION["unc"]=$this->username;
mysql_query("update root set logintimes=logintimes+1,lastlogintime='".date("Y-m-d H:i:s")."'",$conn);
echo "";
}
}
}
$obj=new chkuserlogin($_POST["username"],md5($_POST["password"]));
$obj->chk();
?>