當前位置: 首頁>>代碼示例>>PHP>>正文


PHP real_ip函數代碼示例

本文整理匯總了PHP中real_ip函數的典型用法代碼示例。如果您正苦於以下問題:PHP real_ip函數的具體用法?PHP real_ip怎麽用?PHP real_ip使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了real_ip函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendsms

function sendsms($mobile, $content)
{
    $log = date('Y-m-d H:i:s', time()) . " | " . real_ip() . " | " . $mobile . " | " . $content . "\r\n";
    file_put_contents(dirname(dirname(__FILE__)) . "/sms_log_" . $GLOBALS['_CFG']['ihuyi_sms_user_name'] . ".log", $log, FILE_APPEND);
    //配置信息
    $target = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";
    //替換成自己的測試賬號,參數順序和wenservice對應
    $post_data = "account=" . $GLOBALS['_CFG']['ihuyi_sms_user_name'] . "&password=" . md5($GLOBALS['_CFG']['ihuyi_sms_pass_word']) . "&md5=1&mobile=" . $mobile . "&content=" . urlencode($content);
    $gets = '<?xml version="1.0" encoding="utf-8"?>
	<SubmitResult xmlns="http://106.ihuyi.cn/">
	<code>2</code>
	<msg>提交成功</msg>
	<smsid>67472311</smsid>
	</SubmitResult>';
    if ($GLOBALS['_CFG']['ihuyi_sms_debug'] == 0) {
        $gets = ihuyi_Post($post_data, $target);
    }
    $gets_arr = xml_to_array($gets);
    file_put_contents(dirname(dirname(__FILE__)) . "/sms_log_" . $GLOBALS['_CFG']['ihuyi_sms_user_name'] . ".log", '發送狀態:' . $gets_arr['SubmitResult']['msg'] . "\r\n", FILE_APPEND);
    if ($gets_arr['SubmitResult']['code'] == 2) {
        return true;
    } else {
        return $gets_arr['SubmitResult']['msg'];
    }
}
開發者ID:nanhuacrab,項目名稱:ecshop,代碼行數:25,代碼來源:lib_sms.php

示例2: info

 public static function info($msg, $ecode, $etype, $uid, $schoolid, $requrl, array $param)
 {
     global $G_X;
     if ($requrl == '') {
         $requrl = $_SERVER['REQUEST_URI'];
     }
     if (!$param || count($param) < 1) {
         $param = $_REQUEST;
     }
     $Update = array();
     $Update['eventtime'] = time();
     $Update['eventtype'] = $etype;
     $Update['schoolid'] = $schoolid;
     $Update['eventdesc'] = $msg;
     $Update['message'] = print_r($param, true);
     $Update['userid'] = $uid;
     $Update['requesturl'] = $requrl;
     $Update['code'] = $ecode;
     $Update['detailcode'] = $G_X['events'][$etype][$ecode];
     $ip = real_ip();
     if ($ip == 'unknown') {
         $ip = "192.168.0.1";
     }
     $Update['ip'] = ip2long($ip);
     require_once PUBLIB_PATH . 'database/DbFactory.php';
     $db = DbFactory::Create();
     $id = $db->Insert(self::$tbname, $Update, true);
 }
開發者ID:haitao1880,項目名稱:study,代碼行數:28,代碼來源:XEventLog.php

示例3: contact_us

 public function contact_us($data)
 {
     $this->db->set('date_on', 'NOW()', FALSE);
     $this->db->set('ip_address', real_ip());
     $this->db->insert('contact', $data);
     return $this->db->insert_id();
 }
開發者ID:F5-Buddy,項目名稱:restfullapi-in-codeigniter,代碼行數:7,代碼來源:starter.php

示例4: admin_log

/**
 * 記錄管理員的操作內容
 *
 * @access  public
 * @param   string      $sn         數據的唯一值
 * @param   string      $action     操作的類型
 * @param   string      $content    操作的內容
 * @param   string      $log_info   直接插入操作的內容
 * @return  void
 */
function admin_log($sn = '', $action, $content, $log_info = '')
{
    if (!$log_info) {
        $log_info = $GLOBALS['_LANG']['log_action'][$action] . $GLOBALS['_LANG']['log_action'][$content] . ': ' . addslashes($sn);
    }
    $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('admin_log') . ' (log_time, user_id, log_info, ip_address) ' . " VALUES ('" . gmtime() . "', {$_SESSION['admin_id']}, '" . stripslashes($log_info) . "', '" . real_ip() . "')";
    $GLOBALS['db']->query($sql);
}
開發者ID:dlpc,項目名稱:ecshop,代碼行數:18,代碼來源:lib_main.php

示例5: check_sms_verifycode

/**
 * 檢查手機驗證碼
 *
 * @access  public
 * @param   string       $mobile            手機號
 * @param   string       $verifycode        手機驗證碼
 * @param   string       $act               綁定類型
 *
 * @return  bool         $bool
 */
function check_sms_verifycode($mobile, $verifycode, $act = SMS_REGISTER)
{
    global $db, $ecs, $_CFG;
    $ip = real_ip();
    $expire = gmtime() - intval($_CFG['ecsdxt_sms_validtime']);
    //驗證碼10分鍾內有效
    $SQL = "SELECT COUNT(id) FROM " . $ecs->table('verifycode') . " WHERE mobile='{$mobile}' AND verifycode='{$verifycode}' AND getip='{$ip}' AND status=1 AND `type`={$act} AND dateline>={$expire}";
    return $db->getOne($SQL) > 0;
}
開發者ID:GYWang1983,項目名稱:fruit,代碼行數:19,代碼來源:lib_sms.php

示例6: phoxy_conf

function phoxy_conf()
{
    $ret = phoxy_default_conf();
    global $_SERVER;
    $ret["ip"] = real_ip();
    $ret['adminip'] = false;
    $ret['api_xss_prevent'] = PRODUCTION;
    if (!$ret['adminip']) {
        ini_set('display_errors', 'Off');
    }
    return $ret;
}
開發者ID:Enelar,項目名稱:matrix,代碼行數:12,代碼來源:rpc.php

示例7: cls_session

 function cls_session(&$db, $session_table, $session_data_table, $session_name = 'ECS_ID', $session_id = '')
 {
     $GLOBALS['_SESSION'] = array();
     if (!empty($GLOBALS['cookie_path'])) {
         $this->session_cookie_path = $GLOBALS['cookie_path'];
     } else {
         $this->session_cookie_path = '/';
     }
     if (!empty($GLOBALS['cookie_domain'])) {
         $this->session_cookie_domain = $GLOBALS['cookie_domain'];
     } else {
         $this->session_cookie_domain = '';
     }
     if (!empty($GLOBALS['cookie_secure'])) {
         $this->session_cookie_secure = $GLOBALS['cookie_secure'];
     } else {
         $this->session_cookie_secure = false;
     }
     $this->session_name = $session_name;
     $this->session_table = $session_table;
     $this->session_data_table = $session_data_table;
     $this->db =& $db;
     //$this->_ip = real_ip();以下代碼解決登陸問題
     if (isset($_COOKIE['real_ipd']) && !empty($_COOKIE['real_ipd'])) {
         $this->_ip = $_COOKIE['real_ipd'];
     } else {
         $this->_ip = real_ip();
         setcookie("real_ipd", $this->_ip, time() + 36000, $this->session_cookie_path);
     }
     if ($session_id == '' && !empty($_COOKIE[$this->session_name])) {
         $this->session_id = $_COOKIE[$this->session_name];
     } else {
         $this->session_id = $session_id;
     }
     if ($this->session_id) {
         $tmp_session_id = substr($this->session_id, 0, 32);
         if ($this->gen_session_key($tmp_session_id) == substr($this->session_id, 32)) {
             $this->session_id = $tmp_session_id;
         } else {
             $this->session_id = '';
         }
     }
     $this->_time = time();
     if ($this->session_id) {
         $this->load_session();
     } else {
         $this->gen_session_id();
         setcookie($this->session_name, $this->session_id . $this->gen_session_key($this->session_id), 0, $this->session_cookie_path, $this->session_cookie_domain, $this->session_cookie_secure);
     }
     register_shutdown_function(array(&$this, 'close_session'));
 }
開發者ID:jinjing1989,項目名稱:wei,代碼行數:51,代碼來源:cls_session.php

示例8: update_user_info

 /**
  * 更新用戶SESSION,COOKIE及登錄時間、登錄次數。
  *
  * @access  public
  * @return  void
  */
 function update_user_info()
 {
     if (!$_SESSION['user_id']) {
         return false;
     }
     /* 查詢會員信息 */
     $time = date('Y-m-d');
     $sql = 'SELECT u.user_money,u.email, u.pay_points, u.user_rank, u.rank_points, ' . ' IFNULL(b.type_money, 0) AS user_bonus, u.last_login, u.last_ip' . ' FROM ' . $this->pre . 'users AS u ' . ' LEFT JOIN ' . $this->pre . 'user_bonus AS ub' . ' ON ub.user_id = u.user_id AND ub.used_time = 0 ' . ' LEFT JOIN ' . $this->pre . 'bonus_type AS b' . " ON b.type_id = ub.bonus_type_id AND b.use_start_date <= '{$time}' AND b.use_end_date >= '{$time}' " . " WHERE u.user_id = '{$_SESSION['user_id']}'";
     if ($row = $this->row($sql)) {
         /* 更新SESSION */
         $_SESSION['last_time'] = $row['last_login'];
         $_SESSION['last_ip'] = $row['last_ip'];
         $_SESSION['login_fail'] = 0;
         $_SESSION['email'] = $row['email'];
         /* 判斷是否是特殊等級,可能後台把特殊會員組更改普通會員組 */
         if ($row['user_rank'] > 0) {
             $sql = "SELECT special_rank from " . $this->pre . "user_rank where rank_id='{$row['user_rank']}'";
             $res = $this->row($sql);
             if ($res['special_rank'] === '0' || $res['special_rank'] === null) {
                 $sql = "update " . $this->pre . "users set user_rank='0' where user_id='{$_SESSION['user_id']}'";
                 $this->query($sql);
                 $row['user_rank'] = 0;
             }
         }
         /* 取得用戶等級和折扣 */
         if ($row['user_rank'] == 0) {
             // 非特殊等級,根據等級積分計算用戶等級(注意:不包括特殊等級)
             $sql = 'SELECT rank_id, discount FROM ' . $this->pre . "user_rank WHERE special_rank = '0' AND min_points <= " . intval($row['rank_points']) . ' AND max_points > ' . intval($row['rank_points']);
             if ($row = $this->row($sql)) {
                 $_SESSION['user_rank'] = $row['rank_id'];
                 $_SESSION['discount'] = $row['discount'] / 100.0;
             } else {
                 $_SESSION['user_rank'] = 0;
                 $_SESSION['discount'] = 1;
             }
         } else {
             // 特殊等級
             $sql = 'SELECT rank_id, discount FROM ' . $this->pre . "user_rank WHERE rank_id = '{$row['user_rank']}'";
             if ($row = $this->row($sql)) {
                 $_SESSION['user_rank'] = $row['rank_id'];
                 $_SESSION['discount'] = $row['discount'] / 100.0;
             } else {
                 $_SESSION['user_rank'] = 0;
                 $_SESSION['discount'] = 1;
             }
         }
     }
     /* 更新登錄時間,登錄次數及登錄ip */
     $sql = "UPDATE " . $this->pre . "users SET" . " visit_count = visit_count + 1, " . " last_ip = '" . real_ip() . "'," . " last_login = '" . gmtime() . "'" . " WHERE user_id = '" . $_SESSION['user_id'] . "'";
     $this->query($sql);
 }
開發者ID:m7720647,項目名稱:demo,代碼行數:57,代碼來源:UsersModel.class.php

示例9: addtj

function addtj()
{
    global $ecs;
    $domain = $ecs->get_domain();
    $ip = real_ip();
    //getIP();
    $client = new soapclient68('http://api.68ecshop.com/record.php?wsdl', true);
    $client->soap_defencoding = 'UTF-8';
    $client->decode_utf8 = false;
    $client->xml_encoding = 'UTF-8';
    //參數轉為數組形式傳遞
    $paras = array('domain' => $domain, 'ip' => $ip);
    //目標方法沒有參數時,可省略後麵的參數
    $result = $client->call('addTongji', $paras);
}
開發者ID:firsteam,項目名稱:falcons,代碼行數:15,代碼來源:lib_soap.php

示例10: _do_login

 /**
  * 執行登陸操作
  * 這個函數要跟 frontend.base.php 中的 _do_login 保持一致
  */
 function _do_login($user_id)
 {
     $mod_user =& m('member');
     $user_info = $mod_user->get(array('conditions' => "user_id = '{$user_id}'", 'join' => 'has_store', 'fields' => 'user_id, user_name, reg_time, last_login, last_ip, store_id'));
     /* 店鋪ID */
     $my_store = empty($user_info['store_id']) ? 0 : $user_info['store_id'];
     /* 保證基礎數據整潔 */
     unset($user_info['store_id']);
     /* 分派身份 */
     $this->visitor->assign($user_info);
     /* 更新用戶登錄信息 */
     $mod_user->edit("user_id = '{$user_id}'", "last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "', logins = logins + 1");
     /* 更新購物車中的數據 */
     $mod_cart =& m('cart');
     $mod_cart->edit("(user_id = '{$user_id}' OR session_id = '" . SESS_ID . "') AND store_id <> '{$my_store}'", array('user_id' => $user_id, 'session_id' => SESS_ID));
 }
開發者ID:woolh,項目名稱:Online,代碼行數:20,代碼來源:api.base.php

示例11: _do_login

 /**
  * 執行登陸操作
  *
  * @param int $user_id
  * @return bool
  */
 function _do_login($user_id)
 {
     $mod_user =& m('member');
     $user_info = $mod_user->get(array('conditions' => $user_id, 'join' => 'manage_mall', 'fields' => 'this.user_id, user_name, reg_time, last_login, last_ip, privs'));
     if (!$user_info['privs']) {
         $this->show_warning('not_admin');
         return false;
     }
     /* 分派身份 */
     $this->visitor->assign(array('user_id' => $user_info['user_id'], 'user_name' => $user_info['user_name'], 'reg_time' => $user_info['reg_time'], 'last_login' => $user_info['last_login'], 'last_ip' => $user_info['last_ip']));
     /* 更新登錄信息 */
     $time = gmtime();
     $ip = real_ip();
     $mod_user->edit($user_id, "last_login = '{$time}', last_ip='{$ip}', logins = logins + 1");
     return true;
 }
開發者ID:BGCX261,項目名稱:zhou3liu-svn-to-git,代碼行數:22,代碼來源:backend.base.php

示例12: cls_session

 function cls_session(&$db, $session_table, $session_data_table, $session_name = 'ECS_ID', $session_id = '')
 {
     $GLOBALS['_SESSION'] = array();
     if (!empty($GLOBALS['cookie_path'])) {
         $this->session_cookie_path = $GLOBALS['cookie_path'];
     } else {
         $this->session_cookie_path = '/';
     }
     if (!empty($GLOBALS['cookie_domain'])) {
         $this->session_cookie_domain = $GLOBALS['cookie_domain'];
     } else {
         $this->session_cookie_domain = '';
     }
     if (!empty($GLOBALS['cookie_secure'])) {
         $this->session_cookie_secure = $GLOBALS['cookie_secure'];
     } else {
         $this->session_cookie_secure = false;
     }
     $this->session_name = $session_name;
     $this->session_table = $session_table;
     $this->session_data_table = $session_data_table;
     $this->db =& $db;
     $this->_ip = real_ip();
     if ($session_id == '' && !empty($_COOKIE[$this->session_name])) {
         $this->session_id = $_COOKIE[$this->session_name];
     } else {
         $this->session_id = $session_id;
     }
     if ($this->session_id) {
         $tmp_session_id = substr($this->session_id, 0, 32);
         if ($this->gen_session_key($tmp_session_id) == substr($this->session_id, 32)) {
             $this->session_id = $tmp_session_id;
         } else {
             $this->session_id = '';
         }
     }
     $this->_time = time();
     if ($this->session_id) {
         $this->load_session();
     } else {
         $this->gen_session_id();
         setcookie($this->session_name, $this->session_id . $this->gen_session_key($this->session_id), time() + 86400 * 7, $this->session_cookie_path, $this->session_cookie_domain, $this->session_cookie_secure);
         //代碼修改 By  www.68ecshop.com
     }
     register_shutdown_function(array(&$this, 'close_session'));
 }
開發者ID:seanguo166,項目名稱:yinoos,代碼行數:46,代碼來源:cls_session.php

示例13: SessionProcessor

 /**
  * 構造函數
  *
  * @author weberliu
  * @param object $db 數據庫對象
  * @param stirng $session_table 數據表名
  * @param string $session_data_table 數據存儲表名
  * @param string $session_name session名稱
  * @param string $session_id session_id
  * @return void
  */
 function SessionProcessor(&$db, $session_table, $session_data_table, $session_name = 'ECM_ID', $session_id = '')
 {
     session_set_save_handler(array(&$this, "_sess_open"), array(&$this, "_sess_close"), array(&$this, "_sess_read"), array(&$this, "_sess_write"), array(&$this, "_sess_destroy"), array(&$this, "_sess_gc"));
     $this->gmtime = gmtime();
     $this->max_life_time = 1440;
     $this->session_cookie_path = COOKIE_PATH;
     $this->session_cookie_domain = COOKIE_DOMAIN;
     //如果開啟二級域名,且未設置COOKIE作用域,則缺省為上級域
     if (defined('ENABLED_SUBDOMAIN') && ENABLED_SUBDOMAIN && !COOKIE_DOMAIN) {
         $tmp_arr = parse_url(SITE_URL);
         if (count(explode('.', $tmp_arr['host'])) > 2) {
             $cookie_domain = substr($tmp_arr['host'], strpos($tmp_arr['host'], '.'));
         } else {
             // 形如ecmall.com這樣的域名
             $cookie_domain = '.' . $tmp_arr['host'];
         }
         $this->session_cookie_domain = $cookie_domain;
     }
     $this->session_cookie_secure = false;
     $this->session_name = $session_name;
     $this->session_table = $session_table;
     $this->session_data_table = $session_data_table;
     $this->db =& $db;
     $this->_ip = real_ip();
     /*處理session id*/
     if ($session_id == '' && !empty($_COOKIE[$this->session_name])) {
         $this->session_id = $_COOKIE[$this->session_name];
     } else {
         $this->session_id = $session_id;
     }
     if ($this->session_id) {
         $tmp_session_id = substr($this->session_id, 0, 32);
         if ($this->gen_session_key($tmp_session_id) == substr($this->session_id, 32)) {
             $this->session_id = $tmp_session_id;
         } else {
             $this->session_id = '';
         }
     }
     if (!$this->session_id) {
         $this->gen_session_id();
         session_id($this->session_id . $this->gen_session_key($this->session_id));
         /*setcookie($this->session_name, $this->session_id . $this->gen_session_key($this->session_id), 0,
           $this->session_cookie_path, $this->session_cookie_domain, $this->session_cookie_secure);*/
     }
 }
開發者ID:zhangxiaoling,項目名稱:ecmall,代碼行數:56,代碼來源:session.lib.php

示例14: WriteLog

/**
 * 寫入日誌,統計所需要
 * @author Neil
 */
function WriteLog($return = '')
{
    global $G_X;
    session_start();
    $int = real_ip() . "[|cut|]";
    $int .= date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "[|cut|]";
    $int .= $G_X['appkey'] . "[|cut|]";
    $int .= (session_id() ?: '-') . "[|cut|]";
    $int .= $_SERVER['REQUEST_METHOD'] . "[|cut|]";
    $int .= "record.php[|cut|]";
    $int .= ($_SERVER['HTTP_REFERER'] ?: '-') . "[|cut|]";
    $int .= ($_SERVER['QUERY_STRING'] ?: '-') . "[|cut|]";
    $int .= $_SERVER['HTTP_USER_AGENT'] . "[|cut|]";
    $int .= '-';
    $int .= PHP_EOL;
    $log = ERRLOG_PATH . 'm_wonaonao_record_' . date('H') . '.log';
    error_log($int, 3, $log);
}
開發者ID:haitao1880,項目名稱:study,代碼行數:22,代碼來源:record.php

示例15: visit_stats

 /**
  * 統計訪問信息
  *
  * @access  public
  * @return  void
  */
 function visit_stats()
 {
     if (C('visit_stats') == 'off') {
         return;
     }
     $time = gmtime();
     /* 檢查客戶端是否存在訪問統計的cookie */
     $visit_times = !empty($_COOKIE['ECS']['visit_times']) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1;
     setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/');
     $browser = get_user_browser();
     $os = get_os();
     $ip = real_ip();
     $area = ecs_geoip($ip);
     /* 語言 */
     if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';');
         $lang = addslashes($pos !== false ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     } else {
         $lang = '';
     }
     /* 來源 */
     if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) {
         $pos = strpos($_SERVER['HTTP_REFERER'], '/', 9);
         if ($pos !== false) {
             $domain = substr($_SERVER['HTTP_REFERER'], 0, $pos);
             $path = substr($_SERVER['HTTP_REFERER'], $pos);
             /* 來源關鍵字 */
             if (!empty($domain) && !empty($path)) {
                 save_searchengine_keyword($domain, $path);
             }
         } else {
             $domain = $path = '';
         }
     } else {
         $domain = $path = '';
     }
     $sql = 'INSERT INTO ' . $this->pre . 'stats ( ' . 'ip_address, visit_times, browser, system, language, area, ' . 'referer_domain, referer_path, access_url, access_time' . ') VALUES (' . "'{$ip}', '{$visit_times}', '{$browser}', '{$os}', '{$lang}', '{$area}', " . "'" . addslashes($domain) . "', '" . addslashes($path) . "', '" . addslashes(PHP_SELF) . "', '" . $time . "')";
     $this->query($sql);
 }
開發者ID:noikiy,項目名稱:shop-3,代碼行數:45,代碼來源:CommonModel.class.php


注:本文中的real_ip函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。