auth报错
按老师课程编写执行之后,报一个错误,百思不得其解,请求指点
附上authModel.class.php代码:
<?php
class authModel{
private $auth = '';
public function __construct(){
//判断当前是否已经登录
if($_SESSION['auth']&&(!empty($_SESSION['auth']))){
$this -> auth = $_SESSION['auth'];
}
}
//定义登录验证的方法
public function loginsubmit(){
if(empty($_POST['username'])||empty($_POST['password'])){
return false;
}
$username = daddslashes($_POST['username']);
$password = daddslashes($_POST['password']);
if($this->auth = $this->checkuser($username,$password)){
$_SESSION['auth'] = $this->auth;
return true;
}else{
return false;
}
}
public function checkuser($username,$password){
$auth = M('admin')->findOne_by_username($username);
if($auth&&$password == $auth['password']){
return $auth;
}else{
return false;
}
}
public function getAuth(){
return $this->auth;
}
}
?>