Пример #1
0
 public function add($arr)
 {
     $user = FN::i('module.user');
     $arr['datetime'] = time();
     $arr['user_id'] = $user->getUid();
     $arr['log_info'] = FNbase::setEscape(serialize($arr['log_info']), true);
     $arr['result'] = FNbase::setEscape(serialize($arr['result']), true);
     $this->log->add($arr);
 }
Пример #2
0
 public function setValue($key, $value)
 {
     $sql = 'replace into `user_value` (`uid`,`key`,`value`)values("' . $this->getUid() . '","' . $key . '","' . FNbase::setEscape(serialize($value), true) . '")';
     $db = XG::getMysql();
     $db->query($sql);
 }
Пример #3
0
 private function __construct($array, $class)
 {
     $this->classname = $class;
     $this->controllname = call_user_func_array(array($this->classname, 'getControllName'), array());
     $_POST = FNbase::setEscape($_POST);
     $this->action = empty($array['action']) ? '' : $array['action'];
     $this->param = empty($array['param']) ? array() : $array['param'];
     $this->_init_before($this->action);
     $this->_init($this->action);
     $result = $this->_handel($this->action);
     $this->_handle_after($result);
     exit;
 }
Пример #4
0
 protected function setSession($delete = false)
 {
     //$cache = FN::server('cache','session');
     if ($delete) {
         //$cache->delete($this->session);
         $this->st->delete($this->session);
     } else {
         if (empty($this->user)) {
             return false;
         }
         if (empty($this->session)) {
             $this->session = FNbase::random(10);
         }
         //10位的随机性已经足够
         $this->st->add(array('session' => $this->session, 'value' => FNbase::setEscape(json_encode($this->user), true), 'inserttime' => FNbase::getTime(), 'cachetime' => $this->cacheTime), true);
         //$cache->set($this->session,json_encode($this->user),false,$this->cacheTime);
         if (isset($this->user['password']) && $this->user['password']) {
             $this->login = '******';
         }
     }
     $this->setCookie($delete);
     return true;
 }