主页 M

php面向对象编程登陆类

2014-05-22 网页编程网 网页编程网
class Login{
	public $conn;	
	public $u;
	public $p;
	public function __construct($u,$p){
		$this->u=$u;
		$this->p=$p;
		$this->conn=mysqli_connect("192.192.192.7","userTest","userTest123123","wmshd");
		$this->conn->query('SET NAMES UTF8');
	}
	public function login(){
		$sql="SELECT password,db FROM setting_user WHERE user='".$this->u."'";
		$q=$this->conn->query($sql);
		$r=$q->fetch_array(MYSQLI_USE_RESULT);
		if($this->p==$r["password"]){
			return $r["db"];
		}else{
			return 0;
		}//if
	}//login

}//
阅读原文
阅读 3988
123 显示电脑版