Beispiel #1
0
 public function dologin()
 {
     $this->form_validation->set_rules('username', 'Username', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     if ($this->form_validation->run() == FALSE) {
         errorRedirct('backend/user/login', '用户名和密码不能为空');
         die;
     } else {
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $this->load->model('backend/adminUser');
         $adminUserInfo = $this->adminUser->getAdminUserByName($username);
         if (empty($adminUserInfo)) {
             errorRedirct('backend/user/login', '登录失败,账号不存在');
             die;
         }
         if (!$adminUserInfo['status']) {
             errorRedirct('backend/user/login', '登录失败,账号已失效');
             die;
         }
         if ($adminUserInfo['password'] != md5($password)) {
             errorRedirct('backend/user/login', '登录失败,密码错误');
             die;
         }
         // 更新用户登录时间
         $fields = array('last_ip' => getClientIp(), 'last_time' => time());
         $this->adminUser->updateUserInfo($adminUserInfo['user_id'], $fields);
         $data = array('userId' => $adminUserInfo['user_id'], 'userName' => $adminUserInfo['user_name'], 'realName' => $adminUserInfo['real_name']);
         $this->session->set_userdata($data);
         successRedirct($this->config->item('rbac_default_index'), "登录成功!");
     }
 }
Beispiel #2
0
 /**
  * check client province in ad's geo target
  * input array province number
  * return boolean
  */
 public function checkGeo($listCountries, $listProvinces)
 {
     if (empty($listCountries)) {
         return true;
     }
     $retval = false;
     $ip = getClientIp();
     //live
     //test tren local
     if (isLocal()) {
         $ip = '115.78.162.134';
         // test
     }
     $geoip = GeoBaseModel::getGeoByIp($ip);
     if ($geoip) {
         if (empty($listProvinces)) {
             $retval = in_array($geoip->country_code, $listCountries);
         } else {
             $province = "{$geoip->country_code}:{$geoip->region}";
             $retval = in_array($province, $listProvinces);
         }
     }
     // pr($geoip);
     // pr($retval);
     return $retval;
 }
Beispiel #3
0
function getCurUserHostAddress($userAddress = NULL)
{
    if (is_null($userAddress)) {
        $userAddress = getClientIp();
    }
    return preg_replace("[^0-9a-zA-Z.=]", '_', $userAddress);
}
 /**
  * 授权
  */
 public function getOpenID()
 {
     $weObj = new \System\lib\Wechat\Wechat($this->config("WEIXIN_CONFIG"));
     $this->weObj = $weObj;
     if (empty($_GET['code']) && empty($_GET['state'])) {
         $callback = getHostUrl();
         $reurl = $weObj->getOauthRedirect($callback, "1");
         redirect($reurl, 0, '正在发送验证中...');
         exit;
     } elseif (intval($_GET['state']) == 1) {
         $accessToken = $weObj->getOauthAccessToken();
         // 是否有用户记录
         $isUser = $this->table('user')->where(["openid" => $accessToken['openid'], 'is_on' => 1])->get(null, true);
         /*var_dump($isUser);exit();*/
         if ($isUser == null) {
             //没有此用户跳转至输入注册的页面
             header("LOCATION:" . getHost() . "/register.html");
         } else {
             $userID = $isUser['id'];
             $updateUser = $this->table('user')->where(['id' => $userID])->update(['last_login' => time(), 'last_ip' => ip2long(getClientIp())]);
             $_SESSION['userInfo'] = ['openid' => $isUser['openid'], 'userid' => $isUser['id'], 'nickname' => $isUser['nickname'], 'user_img' => $isUser['user_img']];
             //var_dump($_SESSION['userInfo']['openid']);exit();
             header("LOCATION:http://onebuy.ping-qu.com");
             //进入网站成功
             //用户取消授权
             //
             //$this->R('','90006');
         }
     }
 }
Beispiel #5
0
 public function checkGeo()
 {
     $targetGeo = json_decode($this->target_geo);
     if ($targetGeo) {
         $clientCountry = strtolower(geoip_country_code_by_name(getClientIp()));
         if (in_array($clientCountry, $targetGeo)) {
             return true;
         }
     }
     return false;
 }
    /**
     * 错误列表显示
     *
     * @param string $message
     * @param code   $code
     */
    public function __construct($message = 0, $code = null)
    {
        if (_CLI_) {
            $file = $this->getFile();
            $line = $this->getLine();
            $now = date('Y-m-d H:i:s');
            $out = <<<EOF
==================================================================================
--                         Uncaught exception!
--时间:{$now}
--信息:{$message}
--代码:{$code}
--文件:{$file}
--行数:{$line}
==================================================================================

EOF;
            echo $out;
        } elseif (_DEV_) {
            $this->_viewer = Leb_View::getInstance();
            $this->_viewer->setLayoutPath('_template/layout/');
            $this->_viewer->setLayout('exception');
            $this->_viewer->setTemplate($this->_exceptionFile);
            $this->_viewer->title = '出错了!';
            $time = date('Y-m-d H:i:s', time());
            $this->_viewer->time = $time;
            $this->_viewer->message = $message;
            $this->_viewer->code = $code;
            $this->_viewer->file = $this->getFile();
            $this->_viewer->line = $this->getLine();
            $this->_viewer->run();
            Leb_Debuger::showVar();
        } elseif (defined('_ER_PAGE_')) {
            $this->_viewer = Leb_View::getInstance();
            $this->_viewer->setLayoutPath('_template/layout/');
            $this->_viewer->setLayout('exception');
            $this->_viewer->setTemplate(_ER_PAGE_);
            $this->_viewer->title = '出错了!';
            $time = date('Y-m-d H:i:s', time());
            $this->_viewer->time = $time;
            $this->_viewer->message = $message;
            $this->_viewer->code = $code;
            $this->_viewer->file = $this->getFile();
            $this->_viewer->line = $this->getLine();
            $this->_viewer->run();
            Leb_Debuger::showVar();
        }
        if (_RUNTIME_) {
            $now = time();
            $file = _RUNTIME_ . date('-Y-m-d', $now);
            $line = date('H:i:s') . "\t" . getClientIp() . "\r\n";
        }
    }
function passDataToApplication($url)
{
    $_SERVER['REQUEST_URI'] = modifyUrl($url);
    $_GET['loggedAt'] = getLoggedAt();
    $_GET['cip'] = getClientIp();
    $_GET['ua'] = $_SERVER['HTTP_USER_AGENT'];
    require_once __DIR__ . '/../app/bootstrap.php.cache';
    require_once __DIR__ . '/../app/AppKernel.php';
    $kernel = new AppKernel('prod', false);
    $kernel->loadClassCache();
    $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
    $kernel->handle($request);
}
 public function isValid($ip = null)
 {
     empty($ip) && ($ip = getClientIp(1));
     if (!is_numeric($ip)) {
         $ip = ip2long($ip);
     }
     if (in_array($ip, $this->_ipWhiteListLong)) {
         return true;
     }
     foreach ($this->_ipWhiteListLongRange as $range) {
         if ($ip >= $range[0] && $ip <= $range[1]) {
             return true;
         }
     }
     return false;
 }
Beispiel #9
0
 function addAction($primkey, $urid, $page, $systemtype = USCIC_SMS, $actiontype = 1)
 {
     global $db;
     $query = 'INSERT INTO ' . Config::dbSurveyData() . '_actions (primkey, sessionid, urid, suid, ipaddress, systemtype, action, actiontype, params, language, mode, version) VALUES (';
     if ($primkey != '') {
         $query .= '\'' . prepareDatabaseString($primkey) . '\', ';
     } else {
         $query .= 'NULL, ';
     }
     $query .= '\'' . session_id() . '\', ';
     if ($urid != '') {
         $query .= '\'' . $urid . '\', ';
     } else {
         $query .= 'NULL, ';
     }
     if ($systemtype == USCIC_SURVEY) {
         $query .= getSurvey() . ', ';
     } else {
         $query .= 'NULL, ';
     }
     $query .= '\'' . prepareDatabaseString(getClientIp()) . '\', ';
     $query .= $systemtype . ', ';
     $query .= '\'' . prepareDatabaseString($page) . '\', ';
     $query .= $actiontype . ', ';
     if (Config::logParams()) {
         //log post vars?
         $query .= ' AES_ENCRYPT(\'' . prepareDatabaseString(serialize($_POST)) . '\', \'' . Config::logActionParamsKey() . '\'), ';
     } else {
         $query .= ' NULL, ';
     }
     if ($systemtype == USCIC_SURVEY) {
         $query .= getSurveyLanguage() . ', ';
         $query .= getSurveyMode() . ', ';
         $query .= getSurveyVersion();
     } else {
         $query .= 'NULL, NULL, NULL';
     }
     $query .= ")";
     $db->executeQuery($query);
     if (isset($this->LogActions[$primkey])) {
         //unset so it is read in again..
         unset($this->LogActions[$primkey]);
     }
 }
 /**
  * 登录动作
  */
 private function loginAction($manager, $loginStatus, $isAutoLogin)
 {
     $_SESSION['manager_id'] = $manager['id'];
     $_SESSION['manager_name'] = $manager['manager_name'];
     $_SESSION['role_base_id'] = $manager['role_base_id'];
     $_SESSION['autoLogin'] = $loginStatus;
     if ($isAutoLogin == 1) {
         $expire = 60 * 60 * 24 * 7;
         $timeout = time() + $expire;
         $token = md5(uniqid(rand(), TRUE));
         $autoLogin = ['manager_id' => $manager['manager_id'], 'identifier' => $manager['identifier'], 'timeout' => $timeout];
         //$this->S()->set($token,$autoLogin,60*60*24*7);
         setcookie('OneTrade-AUTOLOGIN', $token, $timeout, '/');
     }
     //更新用户信息
     $data = ['last_ip' => getClientIp(), 'manager_endlogin' => time()];
     $this->table('manager')->where(['id' => $manager['id']])->update($data);
     $this->R();
 }
Beispiel #11
0
 /**
  * check client province in ad's geo target
  * input array province number
  * return boolean
  */
 public function checkGeo($listCountries, $listProvinces)
 {
     if (empty($listCountries) || isLocal()) {
         return true;
     }
     $retval = false;
     $ip = getClientIp();
     //live
     $geoip = GeoBaseModel::getGeoByIp($ip);
     pr($geoip);
     if ($geoip) {
         if (empty($listProvinces)) {
             $retval = in_array($geoip->country_code, $listCountries);
         } else {
             $province = "{$geoip->country_code}:{$geoip->region}";
             $retval = in_array($province, $listProvinces);
         }
     }
     return $retval;
 }
Beispiel #12
0
 /**
  * Saves data
  * @return bool
  * @uses get()
  * @uses $file
  */
 public function save()
 {
     //Gets existing data
     $data = $this->get();
     $agent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
     $ip = getClientIp();
     //Clears the first log (last in order of time), if it has been saved
     //  less than an hour ago and the user agent and the IP address are
     //  the same
     if (!empty($data[0]) && (new Time($data[0]->time))->modify('+1 hour')->isFuture() && $data[0]->agent === $agent && $data[0]->ip === $ip) {
         unset($data[0]);
     }
     //Adds log for current request
     array_unshift($data, (object) am(['ip' => getClientIp(), 'time' => new Time()], parse_user_agent(), compact('agent')));
     //Keeps only the first records
     $data = array_slice($data, 0, config('users.login_log'));
     //Serializes
     $data = serialize($data);
     return $this->file->write($data);
 }
<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$result = $api->getDeptList($companyId, $model->getToken($companyId), getClientIp());
OpenUtils::outputJson($result);
<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$userlist = $api->getUserList($companyId, $model->getToken($companyId), getClientIp());
OpenUtils::outputJson($userlist);
					<div class="wpcf7" id="wpcf7-f137-p135-o1" dir="ltr" lang="en-US">
						<div class="screen-reader-response"></div>
						<form name="" action="/commercial/town-center-acacia-estates/#wpcf7-f137-p135-o1" method="post" class="wpcf7-form" novalidate="novalidate">
							<div style="display: none;">
								<input name="_wpcf7" value="137" type="hidden">
								<input name="_wpcf7_version" value="4.1.1" type="hidden">
								<input name="_wpcf7_locale" value="en_US" type="hidden">
								<input name="_wpcf7_unit_tag" value="wpcf7-f137-p135-o1" type="hidden">
								<input name="_wpnonce" value="715fc56071" type="hidden">
								<input name="property" value="<?php 
echo get_the_title();
?>
" type="hidden">
								<input name="propertyType" value="commercial" type="hidden">
								<input type="hidden" name="clientIp" id="clientIp" value="<?php 
echo getClientIp();
?>
" />
							</div>
							
							<div class="col-md-6">
								<div class="form-group ">
									<span class="wpcf7-form-control-wrap fname">
										<input name="fname" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required form-control" id="fname" aria-required="true" aria-invalid="false" placeholder="First Name" type="text">
									</span>
								</div>
							</div>

							<div class="col-md-6">
								<div class="form-group">
									<span class="wpcf7-form-control-wrap lname">
Beispiel #16
0
                    }
                }
            }
        }
    }
    return $ipaddress;
}
$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$cwd = "/var/www/html/";
$ret = "";
$stdout = "";
$stderr = "";
if (isset($_POST['ping']) && $_POST['ping'] != "") {
    //write entry to log file
    $f = fopen("logs", 'a');
    fwrite($f, getClientIp() . " -- " . $_POST['ping'] . "\n");
    //do some sanitization
    $_POST['ping'] = str_replace(">", " ", $_POST['ping']);
    $_POST['ping'] = scrub($_POST['ping']);
    //$ret = exec('ping -c 1 \'' . $_POST['ping'] . "'", $pingResults);
    $ret = proc_open('ping -c 1 \'' . $_POST['ping'] . "'", $descriptorspec, $pipes, $cwd);
    //parse stdout so formatting is preserve
    $stdout = stream_get_contents($pipes[1]);
    $stdout = htmlentities($stdout);
    //prevent xss
    fclose($pipes[1]);
    $stdout = str_replace("\n", "<br>", $stdout);
    //parse stderr the same
    $stderr = stream_get_contents($pipes[2]);
    $stderr = htmlentities($stderr);
    //prevent xss
            $realip .= $HTTP_SERVER_VARS["REMOTE_ADDR"];
        }
    } else {
        if (getenv('HTTP_X_FORWARDED_FOR')) {
            $realip .= getenv('HTTP_X_FORWARDED_FOR');
        }
        if (getenv('HTTP_CLIENT_IP')) {
            $realip .= getenv('HTTP_CLIENT_IP');
        }
        if (getenv('REMOTE_ADDR')) {
            $realip .= getenv('REMOTE_ADDR');
        }
    }
    return $realip;
}
$client_ip = getClientIp();
$ini = parse_ini_file('config.php', true);
if (empty($ini['settings'])) {
    $ini['settings'] = array();
}
$is_ip_allowed = false;
if (isset($ini['ait_allowed_ips'])) {
    $allowed_ips = $ini['ait_allowed_ips'];
    foreach ($allowed_ips as $value) {
        if (@strstr($client_ip, $value)) {
            $is_ip_allowed = true;
        }
    }
}
if (!$is_ip_allowed) {
    die('Your ip is not allowed');
<?php

//单点登录,客户端点击第三方icon调转
require '../../lib.php';
$companyId = $_GET['company_id'];
$hashkey = $_GET['hashkey'];
$openId = $_GET['open_id'];
$to_open_id = $_GET['to_open_id'];
$hashskey = $_GET['hashskey'];
$returnurl = $_GET['returnurl'];
if ($hashkey == md5($companyId . OpenConfig::APPID . OpenConfig::APPSECRET) && $returnurl == 1) {
    $model = new CSCorpModel();
    $api = OpenHelper::api();
    $result = $api->verifyLoginHashskey($companyId, $model->getToken($companyId), getClientIp(), $openId, $hashskey);
    if ($result['ret'] == 0) {
        $api->pushNotifyCenter2Client($companyId, $model->getToken($companyId), getClientIp(), $openId);
        TestUser::user()->login($openId);
        header('Location:../../');
    } else {
        echo $result['msg'];
    }
} else {
    echo "单点登录失败,hashkey失效";
}
Beispiel #19
0
<?php
function getClientIp() {
    if (!empty($_SERVER["HTTP_CLIENT_IP"]))
        $ip = $_SERVER["HTTP_CLIENT_IP"];
    else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
        $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    else if (!empty($_SERVER["REMOTE_ADDR"]))
        $ip = $_SERVER["REMOTE_ADDR"];
    else
        $ip = "err";
    return $ip;
}

echo "IP: " . getClientIp() . "";
echo "referer: " . $_SERVER["HTTP_REFERER"];

?>
<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$userlist = $model->getUserList($companyId);
$before = array();
if ($userlist !== false) {
    $times = 100;
    do {
        $rand_index = rand(0, count($userlist) - 1);
        $before = $userlist[$rand_index];
    } while ($before['open_id'] == $openId && $times--);
}
if (isset($rand_index) && $before['open_id'] != $openId) {
    $result = $api->delUser($companyId, $model->getToken($companyId), getClientIp(), $before['open_id']);
}
$result = array('删除成员信息' => $before, '删除结果' => $result);
OpenUtils::outputJson($result);
Beispiel #21
0
if (empty($_SESSION['step']['client'])) {
    if (!file_exists('config/config.php')) {
        $_SESSION['step']['client'] = '';
        $error[] = array('danger', 'No Config File found! Please use the <b><a href="admin.php">Setup</a></b> to Configure the Group Assigner!');
    } else {
        $_SESSION['step']['client'] = 'client_selection';
    }
}
if ($_SESSION['step']['client'] == 'client_selection') {
    if (empty($ts3)) {
        $ts3 = ts3connect();
    }
    if (is_string($ts3)) {
        $error[] = array('danger', 'Can not Connect to Server! ' . $ts3);
    } else {
        $detected_clients = $ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp()));
        if (!empty($_POST['uid'])) {
            if (strlen($_POST['uid']) != 28 || substr($_POST['uid'], -1, 1) != '=') {
                $error[] = array('danger', 'Invalid UID Format!');
            } else {
                $skip = false;
                try {
                    $client = $ts3->clientGetByUid($_POST['uid']);
                } catch (TeamSpeak3_Exception $e) {
                    $skip = true;
                    if ($e->getMessage() == 'invalid clientID') {
                        $error[] = array('danger', 'No Client with this UID online found!');
                    } else {
                        $error[] = array('danger', 'Error happened :/ (' . $e . ')');
                    }
                }
 public function insert()
 {
     $name = $this->getActionName();
     $model = D($name);
     if (false === ($data = $model->create())) {
         $this->error($model->getError());
     }
     $avatar_img = '';
     if ($upload_list = $this->uploadImages()) {
         $avatar_img = $upload_list[0]['recpath'] . $upload_list[0]['savename'];
     }
     $data['user_name_match'] = segmentToUnicodeA($data['user_name']);
     Vendor("common");
     //==================添加第三方整合会员添加 chenfq 2011-10-14================
     //第三方整合关联ID,在对应的user表中,要创建应该字段
     if (fanweC('INTEGRATE_CODE') != 'fanwe') {
         $user_field = fanweC('INTEGRATE_FIELD_ID');
         $integrate_id = intval($old_user[$user_field]);
         $user_name = $_REQUEST['user_name'];
         $password = $_REQUEST['password'];
         $email = $_REQUEST['email'];
         FS("Integrate")->adminInit(fanweC('INTEGRATE_CODE'), fanweC('INTEGRATE_CONFIG'));
         $integrate_id = FS("Integrate")->addUser($user_name, $password, $email);
         //echo $integrate_id; exit;
         if ($integrate_id < 0) {
             //失败提示
             $info = FS("Integrate")->getInfo();
             //$this->saveLog(0,$uid);
             $this->error("整合会员添加返回出错:" . $integrate_id . ';' . $info);
         }
         $data[$user_field] = $integrate_id;
     }
     //==================添加第三方整合会员添加chenfq 2011-10-14================
     //保存当前数据对象
     $uid = $model->add($data);
     if ($uid !== false) {
         if (!empty($avatar_img)) {
             FS('User')->saveAvatar($uid, FANWE_ROOT . $avatar_img);
         }
         D('UserCount')->add(array('uid' => $uid));
         $user_status = array('uid' => $uid, 'reg_ip' => getClientIp());
         D('UserStatus')->add($user_status);
         $data = $_REQUEST['up'];
         $data['uid'] = $uid;
         D('UserProfile')->add($data);
         $access_list = $_REQUEST['access_node'];
         foreach ($access_list as $module => $actions) {
             $index = 0;
             foreach ($actions as $action) {
                 $item = array();
                 $item['uid'] = $uid;
                 $item['module'] = $module;
                 $item['action'] = $action;
                 $item['sort'] = $index++;
                 D('UserAuthority')->add($item);
             }
         }
         $this->saveLog(1, $uid);
         $this->assign('jumpUrl', Cookie::get('_currentUrl_'));
         $this->success(L('ADD_SUCCESS'));
     } else {
         //失败提示
         $this->saveLog(0, $uid);
         $this->error(L('ADD_ERROR'));
     }
 }
            }
        }
        return trim($ipaddr);
    }
}
$IpLimitterConfig = ClassRegistry::init('IpLimitter.IpLimitterConfig');
$datas = $IpLimitterConfig->findExpanded();
if ($datas) {
    if (empty($datas['allowed_ip'])) {
        return;
    }
    $allowedIp = preg_quote($datas['allowed_ip']);
    $patterns = str_replace("\\*", '.+?', $allowedIp);
    $patterns = explode(',', $patterns);
    foreach ($patterns as $pattern) {
        if (preg_match('/' . $pattern . '/', getClientIp())) {
            return;
        }
    }
    if (empty($datas['limit_folders'])) {
        header("HTTP/1.0 404 Not Found");
    } else {
        $limitFolders = explode(',', $datas['limit_folders']);
        $folder = explode('/', getUrlParamFromEnv());
        if (!empty($folder[0])) {
            $folder = $folder[0];
            if (in_array($folder, $limitFolders)) {
                if (empty($datas['redirect_url'])) {
                    header("HTTP/1.0 404 Not Found");
                } else {
                    header("Location: " . $datas['redirect_url']);
Beispiel #24
0
 /**
  * Constructor
  * @param \Cake\Mailer\Email|null $email Email instance
  * @uses Cake\Mailer\Mailer::__construct()
  */
 public function __construct(\Cake\Mailer\Email $email = null)
 {
     parent::__construct($email);
     $this->_email->profile('default')->helpers('MeTools.Html')->set('ipAddress', getClientIp())->from(config('email.webmaster'), config('main.title'))->sender(config('email.webmaster'), config('main.title'))->emailFormat('html');
 }
 /**
  * 环境变量设置
  *
  */
 protected function _init()
 {
     // 初始化用户应用级共用数据
     $appPath = _APP_ . $this->getRouter()->getApp();
     $application = realpath($appPath . '/_application.php');
     if ($application && file_exists($application)) {
         include_once $application;
         $myApplication = $this->_application . 'Application';
         $myApplication = new $myApplication();
         $myApplication->init($this);
     }
     // 需要登录访问的 $this->_application
     if (!in_array($this->_application, array('admin', 'tools'))) {
         return;
     }
     $model = $this->loadAppModel('admin');
     $menuModel = $this->loadModel('menu', array(), 'admin');
     $isLogin = $model->isLogin();
     app()->user->setName('游客');
     if ($isLogin) {
         app()->user->setName($model->uname);
         app()->user->setId($model->uid);
         define('UNAME', app()->user->getName());
         define('UID', app()->user->getId());
         define('LAST_LOGIN', $model->last_time);
         $userAllMenum = array();
         $topMenuWhere = "parent_id=0 AND status=1 AND is_conceal=0";
         //////////////////////////////////////////////////////////////////////////////// 后台权限更新代码
         ////////////////////////////////////////////////////////////////////////////// 后台权限更新代码
         $permission_key = "ADMIN_PERMISSION_SET_KEY";
         $redis = Leb_Dao_Redis::getInstance();
         $permission_str = $redis->get($permission_key);
         if (empty($permission_str)) {
             $permission = $model->query("SELECT permission FROM a_user ORDER BY id ASC ");
             $permission_list = [];
             foreach ($permission as $var) {
                 if (!empty($var['permission'])) {
                     $permission_list[] = $var['permission'];
                 }
             }
             $permission_str = '{' . join(',', $permission_list) . '}';
             $redis->setex($permission_key, 60 * 60 * 10, $permission_str);
         }
         $registerUser = json_decode($permission_str, true);
         //            var_dump($registerUser);
         //            die();
         $loginRegister = $registerUser[UID];
         //            var_dump($loginRegister);die();
         if ($loginRegister && !empty($loginRegister['limit'])) {
             $userTopMenu = array();
             foreach ($loginRegister['limit'] as $key => $val) {
                 $userTopMenu[] = $key;
                 $userAllMenum[$key] = $val;
             }
             if (!empty($userTopMenu)) {
                 $topMenuStr = implode(",", $userTopMenu);
                 $topMenuWhere .= " AND id in({$topMenuStr})";
             }
         }
         //获取菜单
         $defaultRightUrl = '';
         $defaultMenuModel = $this->loadModel('menu', array(), 'admin');
         $topMenu = $menuModel->query("SELECT * FROM a_menus WHERE {$topMenuWhere}");
         if ($topMenu && !empty($topMenu[0]['id'])) {
             if (!empty($loginRegister['default'])) {
                 $rightMenu = $defaultMenuModel->getMenu(array("id" => $loginRegister['default']));
                 if ($rightMenu) {
                     $defaultRightUrl = '/' . $rightMenu['app'] . '/' . $rightMenu['controller'] . '/' . $rightMenu['action'];
                 }
             }
         }
         $this->assign('topMenu', $topMenu);
         $this->assign('defaultRightUrl', $defaultRightUrl);
         $this->assign('defaultUrl', '/admin/default/');
     }
     define('IP', getClientIp());
     if (!$isLogin) {
         //		    $url = $this->buildUrl('default', 'login', 'index');
         if (in_array($this->_application, array('admin')) && !in_array($this->_controller, array('default'))) {
             //                echo '<script type="text/javascript">parent.location="/default/login/";</script>';
             //                die();
         } else {
             //                $this->redirect('', '/default/login/', 0);
         }
     } elseif ($isLogin) {
         //临时权限验证
         if ($this->_controller != 'default' && $this->_application == 'admin') {
             $userMenuWhere = " app='{$this->_application}' AND controller = '{$this->_controller}'";
             $userMenumRe = $menuModel->query("SELECT * FROM a_menus WHERE {$userMenuWhere}");
             if (!$userMenumRe || empty($userMenumRe[0]['id'])) {
                 //                    die("无权限访问");
             }
             $menumSucceed = 0;
             if ($userAllMenum) {
                 foreach ($userAllMenum as $ukey => $uval) {
                     if ($userMenumRe[0]['id'] > 0 && $userMenumRe[0]['id'] == $ukey) {
                         $menumSucceed = 1;
                     }
                     if ($userMenumRe[0]['id'] > 0 && (in_array($userMenumRe[0]['id'], $uval) || in_array($userMenumRe[0]['id'], $uval))) {
                         $menumSucceed = 1;
                     }
                 }
             }
             if (empty($menumSucceed)) {
                 //                    die("无权限访问.");
             }
         }
     }
 }
Beispiel #26
0
<?php

require __DIR__ . '/../library/bootstrap.php';
$clientIp = getClientIp();
$morsedIp = (new Morse\Text())->toMorse($clientIp);
header('Content-Type: text/html; charset=utf-8');
header('X-Your-IP: ' . $clientIp);
header('X-Your-IP-Morse: ' . $morsedIp);
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
?>
<!doctype html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>What is my IP-address - Morse my IP.</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
    <link href="css/morsemyip.css?v2" rel="stylesheet" type="text/css">
</head>
<body>

<div class="splash-container">
    <div class="splash">
        <h2>Your IP-address is:</h2>
        <h1 class="splash-head">
            <?php 
echo $clientIp;
?>
<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$result = $api->getUserMobile($companyId, $model->getToken($companyId), getClientIp(), $openId);
OpenUtils::outputJson($result);
Beispiel #28
0
        }
    }
}
/* ===================================== 配置部分 ========================================== */
$check_time = 300;
//10分钟检查一次
$online_time = 1800;
//统计30分钟的在线用户
$app = t($_GET['app']) ? t($_GET['app']) : 'square';
$mod = t($_GET['mod']) ? t($_GET['mod']) : 'Index';
$act = t($_GET['act']) ? t($_GET['act']) : 'index';
$action = $app . '/' . $mod . '/' . $act;
$uid = isset($_GET['uid']) ? intval($_GET['uid']) : 0;
$uname = t($_GET['uname']) ? t($_GET['uname']) : 'guest';
$agent = getBrower();
$ip = getClientIp();
$refer = '站内';
isset($_SERVER['HTTP_REFERER']) && ($refer = addslashes($_SERVER['HTTP_REFERER']));
$isGuest = $uid == -1 || $uid == 0 ? 1 : 0;
$isIntranet = substr($ip, 0, 2) == '10.' ? 1 : 0;
$cTime = time();
$ext = '';
//记录在线统计.
if ($_GET['action'] == 'trace') {
    /* ===================================== step 1 record track ========================================== */
    $result = Capsule::table('online_logs')->insert(array('day' => date('Y-m-d'), 'uid' => $uid, 'uname' => $uname, 'action' => $action, 'refer' => $refer, 'isGuest' => $isGuest, 'isIntranet' => $isIntranet, 'ip' => $ip, 'agent' => $agent, 'ext' => $ext));
    /* ===================================== step 2 update hits ========================================== */
    //memcached更新.写入全局点击量.每个应用的点击量.每个版块的点击量.
    /* ===================================== step 3 update heartbeat ========================================== */
    if (cookie('online_update') + $check_time < $cTime) {
        // 刷新用户在线时间
Beispiel #29
0
 public static function success($_username = '')
 {
     $connection = connection::byIp(getClientIp());
     if (!is_object($connection)) {
         $connection = new connection();
         $connection->setIp(getClientIp());
     }
     $connection->setFailure(0);
     $connection->setUsername($_username);
     $connection->setStatus('Ok');
     try {
         $connection->save();
     } catch (Exception $e) {
     }
 }
Beispiel #30
-7
$app->group(['prefix' => 'demo'], function ($app) {
    $app->get('tvc', 'App\\Http\\Controllers\\HomeController@demoTVC');
    $app->get('run-vast-support', 'App\\Http\\Controllers\\HomeController@demoVast');
    $app->get('run-popup', 'App\\Http\\Controllers\\HomeController@demoPopup');
    $app->get('balloon', 'App\\Http\\Controllers\\HomeController@demoBalloon');
    $app->get('pause-vast', 'App\\Http\\Controllers\\HomeController@demoPauseVast');
    $app->get('sidekicknew', 'App\\Http\\Controllers\\HomeController@demoSidekick');
});
$app->get('delivery', 'App\\Http\\Controllers\\DeliveryController@adsProcess');
$app->get('delivery/ova', 'App\\Http\\Controllers\\DeliveryController@makeOva');
$app->get('make-vast', ['as' => 'makeVast', 'uses' => 'App\\Http\\Controllers\\DeliveryController@makeVast']);
$app->get('track', 'App\\Http\\Controllers\\DeliveryController@trackEvent');
$app->get('vast', 'App\\Http\\Controllers\\DeliveryController@adsProcess');
$app->get('rt', 'App\\Http\\Controllers\\DeliveryController@retargeting');
$app->get('test-sentinel', 'App\\Http\\Controllers\\DeliveryController@testSentinel');
$app->get('render-vast', 'App\\Http\\Controllers\\DeliveryController@renderVast');
$app->get('get-vast-tag', 'App\\Http\\Controllers\\DeliveryController@getVastTag');
$app->get('conversion', 'App\\Http\\Controllers\\ConversionController@trackingConversion');
$app->get('mapp', 'App\\Http\\Controllers\\DeliveryController@getApiAd');
// use Jenssegers\Mongodb\Model as Moloquent;
// class RT extends Moloquent{
//     protected $table = 'trackings_2015_07';
//     protected $connection = 'mongodb';
// }
//
$app->get('abc', function () {
    $parameters = ["tcp://" . env('REDIS_HOST_CLUSTER', '127.0.0.1')];
    $options = ['cluster' => 'redis'];
    $connection = new Predis\Client($parameters, $options);
    pr($connection->zrange("LatestRequest_104_" . getClientIp(), 0, -1), 1);
});