public function before($context) { /*{{{*/ $curOperator = DAL::get()->find("TeleOperator", $context->request->getCookie('operator')); /** * 如果没有登录,调到登录页面 */ if ($curOperator->isNull()) { header('Location:http://' . URL_PREFIX . 'callcenter.haodf.com/operator/login'); exit; } $bk = $context->request->getCookie('bk'); $ip = RequestDelegate::getIp(); $session = SessionDefault::singleton(); /** * 网站用户已登录,而且允许在外网访问管理后台 * 或者 * 是超级管理员 * 可以在外放访问呼叫中心 */ if (false == RequestDelegate::isOfficeIp()) { if ($bk && isset($session->UserId) && BackYardAuth::authVerificationCode($bk, $session->UserId, $ip) || $curOperator->isSupperAdmin()) { } else { echo "本系统只允许在办公室内使用!"; exit; } } }
private function backYardAuth($context) { $ip = RequestDelegate::getIp(); $userInfo = $context->request->getCookie('userinfo'); $userId = isset($userInfo['id'])?$userInfo['id']:0; $bk = $context->request->getCookie('bk'); return ($bk && isset($userId) && BackYardAuth::authVerificationCode($bk, $userId, $ip)); }
public function before($context) { $ip = RequestDelegate::getIp(); $userInfo = $context->request->getCookie('userinfo'); if(isset($_COOKIE['bk']) && isset($userInfo['id']) && BackYardAuth::authVerificationCode($_COOKIE['bk'], $userInfo['id'], $ip)) { } else if(false == RequestDelegate::isOfficeIp()) { echo '系统错误,请联系技术人员!!!';exit; } }