Пример #1
0
 function user_mdl()
 {
     parent::modelfactory();
     $config =& loader::config();
     $this->cookie_name = $config['cookie_name'];
     $this->cookie_auth_key = $config['cookie_auth_key'];
     $this->cookie_domain = $config['cookie_domain'];
     if (isset($_COOKIE[$this->cookie_name])) {
         $auth = authcode($_COOKIE[$this->cookie_name], 'DECODE', md5($this->cookie_auth_key));
         $auth = explode("\t", $auth);
         $uid = isset($auth[1]) ? $auth[1] : 0;
         $upass = isset($auth[0]) ? $auth[0] : '';
         $this->db->select('#@users', '*', "id=" . intval($uid));
         $uinfo = $this->db->getRow();
         if (!$uinfo) {
             $this->LOGIN_FLAG = false;
         } else {
             if ($uinfo['user_pass'] == $upass) {
                 $this->LOGIN_FLAG = true;
                 $this->uinfo = $uinfo;
             } else {
                 $this->LOGIN_FLAG = false;
             }
         }
     } else {
         $this->LOGIN_FLAG = false;
     }
 }
Пример #2
0
 function save($comment)
 {
     $ret = parent::save($comment);
     if ($ret) {
         $this->update_num($comment['type'], $comment['ref_id']);
     }
     return $ret;
 }