<?php
class admin extends spModel
{
    var $pk ="id";
    var $table="mxszpt_admin";
    
    var $verifier_login=array(
         "rules"=>array(
            'username'=>array(
               'notnull'=>TRUE,
            ),
            'userpassword'=>array(
                'notnull'=>TRUE,
            ),
         ),
         
         "messages"=>array(
            'username'=>array(
               'notnull'=>"用户名不能为空！",
            ),
             'userpassword'=>array(
               'notnull'=>"密码不能为空！",
             ),
         ),
    );

    
        var $verifier_pwedit=array(
         "rules"=>array(
            'us_password'=>array(
                'notnull'=>TRUE,
            ),
         ),
         
         "messages"=>array(
             'us_password'=>array(
               'notnull'=>"新密码不能为空！",
             ),
         ),
    );
    
    
    
    public function userlogin($us_name,$us_password){
        $conditions=array(
           'username'=>$us_name,
           'userpassword'=>$us_password,
        );
        	if( $result = $this->find($conditions) ){ 
			spClass('spAcl')->set($result['aclname']); 
			$_SESSION["userinfo"] = $result; 
			return true;
		}else{
			return false;
		}
    }
  
      	public function acljump(){ 
		$url = spUrl("main","index");
		echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gbk\"><script>function sptips(){alert(\"您如果是管理员，请登录！否则您没有权限进行此操作！\");}</script></head><body onload=\"sptips()\"></body></html>";
		exit;
	}
  
  
}
?>