当前位置: 首页>>代码示例>>PHP>>正文


PHP ip_banned函数代码示例

本文整理汇总了PHP中ip_banned函数的典型用法代码示例。如果您正苦于以下问题:PHP ip_banned函数的具体用法?PHP ip_banned怎么用?PHP ip_banned使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ip_banned函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: attempt_login

function attempt_login($login, $password)
{
    $db = option('db_conn');
    $stmt = $db->prepare('SELECT * FROM users WHERE login = :login');
    $stmt->bindValue(':login', $login);
    $stmt->execute();
    $user = $stmt->fetch(PDO::FETCH_ASSOC);
    if (ip_banned()) {
        login_log(false, $login, isset($user['id']) ? $user['id'] : null);
        return ['error' => 'banned'];
    }
    if (user_locked($user)) {
        login_log(false, $login, $user['id']);
        return ['error' => 'locked'];
    }
    if (!empty($user) && calculate_password_hash($password, $user['salt']) == $user['password_hash']) {
        login_log(true, $login, $user['id']);
        return ['user' => $user];
    } elseif (!empty($user)) {
        login_log(false, $login, $user['id']);
        return ['error' => 'wrong_password'];
    } else {
        login_log(false, $login);
        return ['error' => 'wrong_login'];
    }
}
开发者ID:karupanerura,项目名称:isucon4,代码行数:26,代码来源:index.php

示例2: set_time_limit

include 'configuration.php';
include 'function.php';
set_time_limit(60);
//***********************************************************************************
//***********************************************************************************
if (PEERLIST_DISABLED == TRUE || TIMEKOIN_DISABLED == TRUE) {
    // This has been disabled
    exit;
}
//***********************************************************************************
//***********************************************************************************
// Open connection to database
mysql_connect(MYSQL_IP, MYSQL_USERNAME, MYSQL_PASSWORD);
mysql_select_db(MYSQL_DATABASE);
// Check for banned IP address
if (ip_banned($_SERVER['REMOTE_ADDR']) == TRUE) {
    // Sorry, your IP address has been banned :(
    exit;
}
//***********************************************************************************
//***********************************************************************************
// If Timekoin is NOT running, don't answer Peer Pings to avoid being left in
// active peer lists for a very long time
$main_heartbeat_active = mysql_result(mysql_query("SELECT * FROM `main_loop_status` WHERE `field_name` = 'main_heartbeat_active' LIMIT 1"), 0, "field_data");
if ($main_heartbeat_active == FALSE) {
    exit;
}
//***********************************************************************************
//***********************************************************************************
// Answer poll challenge/ping
if ($_GET["action"] == "poll" && empty($_GET["challenge"]) == FALSE) {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:peerlist.php

示例3: isRemembor

 public function isRemembor()
 {
     $remembor = $_COOKIE["remembor"];
     if ($remembor && !$_SESSION["userInfo"]) {
         $user_r = unserialize(stripcslashes($remembor));
         //安全检测
         if ($user_r["agent"] == $_SERVER["HTTP_USER_AGENT"]) {
             $map["email"] = $user_r["email"];
             $map["passwd"] = $user_r["passwd"];
             $user = $this->where($map)->field("id,name")->find();
             if ($user) {
                 //IP访问控制
                 $site_opts = TS_D("Option")->get();
                 ip_banned($site_opts["deny_ips"], $site_opts["allow_ips"]);
                 //修改最后一次登录IP
                 TS_D("LoginRecord")->record($user["id"]);
                 unset($user["active"]);
                 $_SESSION["userInfo"] = serialize($user);
             }
         }
     }
 }
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:22,代码来源:UserLwModel.class.php

示例4: init__global2


//.........这里部分代码省略.........
    }
    if (!isset($MICRO_AJAX_BOOTUP)) {
        $MICRO_AJAX_BOOTUP = 0;
    }
    require_code_no_override('version');
    if ($MICRO_BOOTUP == 0 && $MICRO_AJAX_BOOTUP == 0) {
        //@header('X-Powered-By: ocPortal '.ocp_version_full().' (PHP '.phpversion().')');
        @header('X-Powered-By: ocPortal');
        // Better to keep it vague, for security reasons
        $QUERY_LOG = false;
        if (isset($_REQUEST['special_page_type']) && $_REQUEST['special_page_type'] == 'query') {
            $QUERY_LOG = true;
        }
    }
    // Most critical things
    require_code('support');
    // A lot of support code is present in this
    srand(make_seed());
    mt_srand(make_seed());
    if ($MICRO_BOOTUP == 0 && $MICRO_AJAX_BOOTUP == 0) {
        if (running_script('index') && count($_POST) == 0) {
            $bot_type = get_bot_type();
            if ($bot_type !== NULL && isset($SITE_INFO['fast_spider_cache']) && $SITE_INFO['fast_spider_cache'] != '0') {
                fast_spider_cache(true);
            }
        }
    }
    require_code('caches');
    // Recently taken out of 'support' so makes sense to load it here
    require_code('database');
    // There's nothing without the database
    if ((!isset($SITE_INFO['known_suexec']) || $SITE_INFO['known_suexec'] == '0') && !is_writable_wrap(get_file_base() . '/.htaccess')) {
        require_code('support2');
        if (ip_banned(get_ip_address())) {
            critical_error('BANNED');
        }
    }
    if (running_script('messages') && get_param('action', 'new') == 'new' && get_param_integer('routine_refresh', 0) == 0) {
        require_code('chat_poller');
        chat_poller();
    }
    if ($MICRO_BOOTUP == 0) {
        load_user_stuff();
    }
    // For any kind of niceness we need these. The order is chosen for complex dependency reasons - don't mess with it
    if ($MICRO_AJAX_BOOTUP == 0) {
        require_code('themes');
        // Output needs to know about themes
        require_code('templates');
        // So that we can do error templates
        require_code('tempcode');
        // Output is done with tempcode
        if ($MICRO_BOOTUP == 0) {
            require_code('comcode');
            // Much output goes through comcode
        }
    }
    require_code('zones');
    // Zone is needed because zones are where all ocPortal pages reside
    require_code('config');
    // Config is needed for much active stuff
    if (get_option('collapse_user_zones', true) === '1' && $RELATIVE_PATH == 'site') {
        get_base_url();
        /*force calculation first*/
        $RELATIVE_PATH = '';
    }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:global2.php

示例5: doReg

 /**
  * doReg
  *
  * 注册
  *
  * @return void
  */
 public function doReg()
 {
     //IP访问控制
     $site_opts = $this->api->option_get();
     ip_banned($site_opts["deny_ips"], $site_opts["allow_ips"]);
     //是否关闭注册
     if ($site_opts["reg_close"] == "1") {
         $this->error("注册已经关闭!");
     }
     //注册验证码
     $verify_allow = unserialize($site_opts["verify"]);
     $reg_verify_allow = $verify_allow['reg'];
     if ($reg_verify_allow) {
         if (md5($_POST['verify']) != $_SESSION['verify']) {
             $this->error('验证码错误!');
         }
     }
     if (empty($_POST['email']) || empty($_POST['name'])) {
         $this->error('邮箱或用户名不能为空!');
     }
     if (strlen($_POST['name']) > 20) {
         $this->error('用户名不能太长!');
     }
     if (strlen($_POST['passwd']) <= 5 || $_POST['passwd'] != $_POST['repasswd']) {
         $this->error('密码不正确,建议您得密码设置为五位以上!');
     }
     //看是否注册过了
     $map_xx["email"] = t($_REQUEST["email"]);
     $user_count = D("User")->where($map_xx)->count();
     //if($user_count != 0) $this->error("你的Email已经被注册过了!");
     $current = explode(",", $_POST["ts_areaval"]);
     $_POST["current_province"] = $current[0];
     $_POST["current_city"] = $current[1];
     $_POST["current_area"] = $current[2];
     $_POST["passwd"] = md5($_POST["passwd"]);
     $userDao = D("User");
     $userDao->create();
     $privacy = $_POST["baseinfoprivacy"];
     $userDao->cTime = time();
     $userDao->active = "1" == $site_opts['reg_email'] ? 0 : 1;
     $uid = $userDao->add();
     $this->__addUserSearch($uid);
     $code = $_POST['code'];
     if ($uid && $site_opts["reg_email"] == "1") {
         $this->jihuo($uid, $_POST["email"], $code);
     } else {
         //登陆
         $userInfo["id"] = $uid;
         $userInfo["name"] = $userDao->name;
         $_SESSION["userInfo"] = serialize($userInfo);
         $this->relation($code, $uid);
         //默认关联系统操作
         //跳转
         $msg = "注册成功!";
         $jump_url = __APP__ . "/Info/face";
         $this->assign('jumpUrl', $jump_url);
         $this->success($msg);
     }
 }
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:66,代码来源:IndexAction.class.php

示例6: init

 final function init()
 {
     //实例化视图类和初始化变量
     $this->tsSetInt();
     //广告。这样子类可以调用同样的方法,稍微修改一下传入参数。就可以调出自己应用的广告
     $this->tsSetAdd($this->opts);
     $this->setSiteOpts($this->opts);
     //查看站点是否关闭了.
     $this->tsSiteClose();
     //登录检测
     $this->__checkLogin();
     //获取用户登陆ID
     $this->mid = $this->api->user_getLoggedInUser();
     $this->uid = intval($_GET["uid"]) ? intval($_GET["uid"]) : $this->mid;
     $this->assign("uid", $this->uid);
     //获得当前应用的appId
     $this->appId = $this->setAppId(APP_NAME);
     if (!$this->mid) {
         //游客权限设置
         $this->tsSetGuest();
     } else {
         //已登陆用户
         //禁止IP访问
         ip_banned($this->opts["deny_ips"], $this->opts["allow_ips"]);
         //用户添加的应用
         $user_app_ids = $this->api->UserApp_getUserAppId($this->mid);
         //除了核心应用和管理页面需要取得当前的应用ID
         if (APP_NAME != 'thinksns' && APP_NAME != 'admin') {
             //检测当前应用的appId
             $this->checkAppId($this->appId, $user_app_ids);
         }
         $this->my_name = $this->api->user_getLoggedInName();
         //记录在线状态
         // $this->api->UserOnline_recordOnline($this->mid,$this->my_name);
         $spaceAppList = $this->api->App_getUserAppList('place', $user_app_ids);
         $appInfo = $this->api->App_getAppInfo($this->appId);
         $this->assign('APPINFO', $appInfo);
         $this->assign('user_apps', $this->api->App_getUserAppList());
         $spaceAppList = $this->api->App_getUserAppList('place', $user_app_ids);
         $userlevel = $this->api->User_getLoggedInUserLevel();
         $groupType = $this->api->SystemGroup_getGroupType($userlevel);
         if ($groupType == 'admin') {
             $this->assign('isAdmin', true);
         }
         //左侧菜单:left_nav,顶部菜单top_navs
         $this->assign($spaceAppList);
         $this->assign('TS_NEED_LOGIN', '1');
         //edit by sam
         $this->assign("mid", $this->mid);
         $this->assign("my_name", $this->my_name);
         $this->assign('notify_num', $notify_num);
         //上部的计数
     }
     //敏感字过滤
     $this->tsFilterSensitive();
     //控制器初始化
     //设置顶部
     isset($appInfo) && ($this->app_title = $appInfo['APP_CNNAME']);
     $this->setTitle();
 }
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:60,代码来源:Action.class.php


注:本文中的ip_banned函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。