public function __construct($state, $action) { session_start(); parent::__construct($state, $action); $this->ip = Ip::getClientIp(); if ($action == 'set' || $action == 'set_tmp_log') { Switcher::close('postRefererCheck'); Switcher::close('masterDbPostOnly'); } }
public function __construct($state, $action) { SESSION_START(); parent::__construct($state, $action); $this->ip = Ip::getClientIp(); if (in_array($action, array('debug'))) { Switcher::close('postRefererCheck'); } //控制外网IP访问管理功能 if (substr($this->ip, 0, 3) != '10.') { header("HTTP/1.0 404 Not Found"); exit; } }
/** * *@description: android获取client_id 是第三方推送过来的信息, 不能保证 登陆前一定能获取到.. 不阻塞用户登陆, 只有获取到之后再进行更新 */ public function updateClientId() { Switcher::close('masterDbPostOnly'); $username = $_POST['username']; $clientId = $_POST['client_id']; $userDB = new AlarmUserModelDB(); if (!empty($username) && !empty($clientId)) { $sql = "SELECT `id` FROM `" . $userDB->getTableName() . "` WHERE `username` = ?"; $userId = $userDB->getFirst($sql, array($username)); if (!empty($userId)) { $updateArr = array(); $updateArr['client_id'] = $clientId; $userDB->update($updateArr, array('id' => $userId)); Message::showSucc('succ'); } else { Message::showError('no such user'); } } else { Message::showError('username or clientid is empty'); } }