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


PHP get_real_ip函数代码示例

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


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

示例1: insertUser

 public function insertUser($data)
 {
     $data["ctime"] = time();
     $data["ip"] = get_real_ip();
     $this->db->insert($this->database, $data);
     return $this->db->insert_id();
 }
开发者ID:utfqvfhpyygy,项目名称:kouyuyouban,代码行数:7,代码来源:UserModel.php

示例2: check_session

function check_session()
{
    if ($GLOBALS['use_ip_in_session'] == 1) {
        $ip = get_real_ip();
    } else {
        $ip = date('m');
    }
    @session_start();
    ini_set('session.cookie_httponly', TRUE);
    // use a cookie to remain logged in
    $user_id = hash_password($GLOBALS['mdp'] . $GLOBALS['identifiant'] . $GLOBALS['salt'], md5($_SERVER['HTTP_USER_AGENT'] . $ip . $GLOBALS['salt']));
    if (isset($_COOKIE['BT-admin-stay-logged']) and $_COOKIE['BT-admin-stay-logged'] == $user_id) {
        $_SESSION['user_id'] = md5($user_id);
        session_set_cookie_params(365 * 24 * 60 * 60);
        // set new expiration time to the browser
        session_regenerate_id(true);
        // Send cookie
        return TRUE;
    }
    if (!isset($_SESSION['user_id']) or $_SESSION['user_id'] != $GLOBALS['identifiant'] . $GLOBALS['mdp'] . md5($_SERVER['HTTP_USER_AGENT'] . $ip)) {
        return FALSE;
    } else {
        return TRUE;
    }
}
开发者ID:CamTosh,项目名称:blogotext,代码行数:25,代码来源:util.php

示例3: GetTracker

 function GetTracker($serverID = "")
 {
     $result = array();
     if (!empty($serverID)) {
         $sql = $this->_serverDB->QueryWithBinds("SELECT NAME, SKILLGAINRATE, ACTIONTIMER, MAXPLAYERS, MAXCREATURES, PERCENT_AGG_CREATURES, PVP, EPIC, MAPNAME FROM SERVERS WHERE SERVER = ?", array($serverID));
         $server = $sql->fetch(PDO::FETCH_ASSOC);
         $server["COUNT"] = $this->GetPlayerCount();
         $server["EXTERNALIP"] = get_real_ip();
         $result = $server;
     }
     return $result;
 }
开发者ID:dkraklan,项目名称:WurmUnlimitedAdmin,代码行数:12,代码来源:class.Server.inc.php

示例4: setLog

 function setLog($data, $_url)
 {
     $new_line = "\r\n";
     $str = "生成时间:" . date("Y-m-d H:i:s") . $new_line;
     $str .= "请求URL:" . $_url . $new_line;
     $str .= "返回数据:" . json_encode($data, JSON_UNESCAPED_UNICODE) . $new_line;
     $str .= "请求IP:" . get_real_ip() . $new_line;
     $str .= $new_line;
     $file_path = Config::get('logPath', '/logs/api_logs/');
     $file_path = rtrim($file_path, "/");
     $filename = $file_path . '/' . date('Ymd') . '/' . date("H") . ".log";
     _write_file($filename, $str);
 }
开发者ID:rainsj,项目名称:note,代码行数:13,代码来源:function.php

示例5: recaptcha_check_answer

 if ($txt_name == '' || $txt_email == '' || $txt_comments == '') {
     $err[] = "All fields are required to submit a review.";
 }
 /********************* RECAPTCHA CHECK *******************************
 	This code checks and validates recaptcha
 	****************************************************************/
 $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
 if (!$resp->is_valid) {
     $err[] = "Image Verification failed! (reCAPTCHA said: " . $resp->error . ")";
 }
 if (empty($err)) {
     $to = $a['emai'];
     //$to      = '"Ben Vigl [TEST MODE]" <ben@benvigil.com>';
     $subject = $a['name'] . ' has been reviewed on AtlantaOccasions.com';
     $headers = 'From: "Occasions Magazine" <do-not-reply@atlantaoccasions.com>' . "\r\n" . 'Reply-To: "Occasions Magazine" <do-not-reply@atlantaoccasions.com>' . "\r\n" . 'X-Mailer: AO3/PHP/' . phpversion();
     $msg = 'The following review of ' . $a['name'] . ' was submitted:' . "\r\n\r\n" . 'Name: ' . $txt_name . "\r\n" . 'Email: ' . $txt_email . "\r\n" . 'Rating: ' . $rdo_rating . "\r\n" . 'Review: ' . "\r\n\r\n" . $txt_comments . "\r\n\r\n\r\n" . '------------------------------------------------------------' . "\r\n" . 'SENT TO : ' . $a['emai'] . "\r\n" . 'SENT AT : ' . date("D F j, Y, g:i a") . "\r\n" . 'FROM IP : ' . get_real_ip() . "\r\n" . '------------------------------------------------------------' . "\r\n";
     mail($to, $subject, $msg, $headers);
     mail(AO_ADMIN_EMAIL, $subject, $msg, $headers);
     mail(AO_TECH_EMAIL, $subject, $msg, $headers);
     // all clear to save the data to the database
     $api = new PodAPI();
     // since we are saving a new profile, these fields need initializing this one time only
     $comment_data['vendor'] = $a['id'];
     $comment_data['name'] = $txt_name;
     $comment_data['email'] = $txt_email;
     $comment_data['rating'] = $rdo_rating;
     $comment_data['comment'] = $txt_comments;
     $comment_data['comment_date'] = date("Y-m-d H:i:s");
     // safety cleansing
     pods_sanitize($comment_data);
     $params = array('datatype' => 'comments', 'columns' => $comment_data);
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:profile.20101023.php

示例6: oplog

 private function oplog($addContent)
 {
     if (empty($addContent)) {
         return false;
     }
     //操作日志记录
     $logAdd['app'] = $this->_application;
     $logAdd['controller'] = $this->_controller;
     $logAdd['action'] = $this->_action;
     $logAdd['content'] = json_encode($addContent);
     $logAdd['ip'] = get_real_ip();
     $logAdd['operat'] = UNAME;
     $this->operateLogModel->addOpLog($logAdd);
 }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:14,代码来源:package.php

示例7: save_reply

 function save_reply()
 {
     if (!$this->setting->get_conf('system.enable_comment')) {
         form_ajax_failed('text', lang('album_comment_closed'));
     }
     $comment['email'] = safe_convert($this->getPost('email'));
     $comment['author'] = safe_convert($this->getPost('author'));
     $comment['content'] = safe_convert($this->getPost('content'));
     $comment['ref_id'] = intval($this->getPost('ref_id'));
     $comment['type'] = intval($this->getPost('type'));
     $comment['reply_author'] = safe_convert($this->getPost('reply_author'));
     $comment['pid'] = intval($this->getPost('pid'));
     $this->plugin->trigger('before_post_comment');
     if ($this->setting->get_conf('system.enable_comment_captcha') && !$this->user->loggedin()) {
         $captcha =& loader::lib('captcha');
         if (!$captcha->check($this->getPost('captcha'))) {
             form_ajax_failed('text', lang('invalid_captcha_code'));
         }
     }
     if ($comment['email'] && !check_email($comment['email'])) {
         form_ajax_failed('text', lang('error_email'));
     }
     if (!$comment['author']) {
         form_ajax_failed('text', lang('error_comment_author'));
     }
     if (!$comment['content']) {
         form_ajax_failed('text', lang('empty_content'));
     }
     if (!$comment['ref_id'] || !$comment['type'] || !$comment['pid'] || !$comment['reply_author']) {
         form_ajax_failed('text', lang('miss_argument'));
     }
     $comment['post_time'] = time();
     $comment['author_ip'] = get_real_ip();
     if ($this->setting->get_conf('system.comment_audit') == 1 && !$this->user->loggedin()) {
         $comment['status'] = 0;
     } else {
         $comment['status'] = 1;
     }
     if ($reply_id = $this->mdl_comment->save($comment)) {
         $comment['id'] = $reply_id;
         $this->output->set('info', $comment);
         $this->plugin->trigger('reply_comment', $reply_id);
         form_ajax_success('text', loader::view('comments/view', false));
     } else {
         form_ajax_failed('text', lang('reply_failed'));
     }
 }
开发者ID:vluo,项目名称:myPoto,代码行数:47,代码来源:comments.ctl.php

示例8: delAction

 public function delAction()
 {
     $midArr = daddslashes($this->postVar('mid', ''));
     if (!empty($midArr)) {
         $delArr = $delApiArr = array();
         foreach ($midArr as $key => $val) {
             $apiSendCallBack = '';
             $messageSet['id'] = $val;
             $messageSet['message_type'] = 1;
             // $messageSet['status'] = -1;
             $getMessage = $this->messageModel->getMessage($messageSet);
             if (intval($getMessage['status']) == 0) {
                 $re = $this->messageModel->deleteMessage($val);
             } else {
                 if (!empty($getMessage['callback_info']) && in_array(UID, array(1, 2, 3, 4, 5))) {
                     $re = $this->messageModel->deleteMessage($val);
                     if ($re) {
                         //删除发送成功的公共消息
                         $sendData['msgid'] = $getMessage['callback_info'];
                         $apiData = json_encode($sendData);
                         $apiData = urlencode($apiData);
                         $apiSendJsonRe = file_get_contents(_API_URL_ . "/admin_public_del_msg.do?data={$apiData}");
                         $apiSendRe = json_decode($apiSendJsonRe, true);
                         if (!empty($apiSendRe['data']['rs']) && 1 == $apiSendRe['data']['rs']) {
                             $apiSendCallBack = "succ";
                         } elseif (isset($apiSendRe['errcode']) && isset($apiSendRe['msg'])) {
                             $apiSendCallBack = $apiSendRe['msg'] . "/errcode_" . $apiSendRe['errcode'];
                         }
                         $delArr[$val] = $apiSendCallBack;
                     }
                 } else {
                     $timeInterval = 5 - intval(time() - strtotime($getMessage['createtime'])) / 60;
                     if ($timeInterval < 0) {
                         $timeInterval = 0;
                     }
                     $timeIntervalStr = strval($timeInterval);
                     echo "<script>if (confirm('暂时不能删除,请于审核通过后5分钟尝试,如果失败,请联系开发确认消息状态!'))\n                            location.href = '/admin/message/'; </script>";
                     //                    confirm("暂时不能删除" . "请于" . strval((time() - strtotime($getMessage['createtime'])) / 60) . "分钟后尝试!");
                 }
             }
         }
         if ($delArr) {
             $logAdd['app'] = $this->_application;
             $logAdd['controller'] = $this->_controller;
             $logAdd['action'] = $this->_action;
             $logAdd['content'] = json_encode($delArr);
             $logAdd['ip'] = get_real_ip();
             $logAdd['operat'] = UNAME;
             $this->operateLogModel->addOpLog($logAdd);
             $this->redirect('', '/admin/message/', 0);
         }
     }
     $this->redirect('', '/admin/message/', 0);
 }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:54,代码来源:message.php

示例9: admin_msg

    $user = $_POST['user'];
    $pwd = $_POST['pwd'];
    //echo (md5($pwd));
    //$rememberme = $_POST['rememberme'] == '1' ? '1':'0';
    if ($user == '' || $pwd == '') {
        admin_msg('login.php', '错误提示:请填写用户名或密码!');
    }
    $result = $db->GetRow("SELECT * FROM mycms_admin_user WHERE (state is null or state !=-2) and username = '" . $user . "' AND password = '" . md5($pwd) . "'");
    if (!$result) {
        admin_msg('login.php', '错误提示:用户名或密码填写错误!');
    } else {
        //session_register("userInfo");
        $_SESSION['userInfo'] = null;
        $_SESSION["userInfo"] = base64_encode(serialize($result));
        //unserialize(base64_decode())
        $db->Execute('UPDATE mycms_admin_user SET lognum=lognum+1 WHERE uid=' . $result['uid']);
        //header('location:index.php');
        $db->Execute("INSERT INTO mycms_admin_log(uid,uname,ltime,lip) VALUES(" . $result['uid'] . ",'" . $result['username'] . "','" . date('Y-m-d h:i:s') . "','" . get_real_ip() . "')");
        header('location:index.php');
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'out') {
    session_destroy();
    header('location:login.php');
} else {
    if (isset($_GET["img"]) || isset($_GET["type"])) {
        $smarty->display('admin/login0.html');
    } else {
        $smarty->display('admin/login.html');
    }
}
$db->close();
开发者ID:liujidong,项目名称:nei,代码行数:31,代码来源:login.php

示例10: auditholdAction

 public function auditholdAction()
 {
     $payId = (int) $this->reqVar('pay_id', 0);
     $dosubmit = daddslashes($this->postVar('dosubmit', ''));
     $remark = daddslashes($this->postVar('remark', ''));
     $setTimeOut = 0;
     $exchangeRe = $this->exchangeModel->getExchange(array('id' => $payId));
     if (!empty($exchangeRe['id']) && !empty($exchangeRe['uid'])) {
         if (!empty($dosubmit)) {
             $exchangeHSet['exchange_id'] = $exchangeRe['id'];
             $isH = $this->exchangeHModel->getExchangeH($exchangeHSet);
             if ($isH) {
                 $this->exchangeHModel->saveExchangeH($exchangeRe['id'], $remark);
             } else {
                 $exchangeHAdd['exchange_id'] = $exchangeRe['id'];
                 $exchangeHAdd['remark'] = $remark;
                 $this->exchangeHModel->addExchangeH($exchangeHAdd);
             }
             //操作记录
             $logAdd['app'] = $this->_application;
             $logAdd['controller'] = $this->_controller;
             $logAdd['action'] = $this->_action;
             $logAdd['content'] = json_encode(array($payId => "暂缓"));
             $logAdd['ip'] = get_real_ip();
             $logAdd['operat'] = UNAME;
             $this->operateLogModel->addOpLog($logAdd);
             $setTimeOut = 1;
         }
     }
     $this->assign('setTimeOut', $setTimeOut);
     $this->assign('payId', $payId);
     $this->getViewer()->needLayout(false);
     $this->render('audit_hold');
 }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:34,代码来源:audit.php

示例11: htmlspecialchars

    $txt_name = '';
    $txt_email = '';
    $txt_phone = '';
    $txt_best = '';
    $txt_comments = '';
    if ($_POST['submitted'] == "1") {
        $txt_name = htmlspecialchars($_POST['txt_name']);
        $txt_email = htmlspecialchars($_POST['txt_email']);
        $txt_phone = htmlspecialchars($_POST['txt_phone']);
        $txt_best = htmlspecialchars($_POST['txt_best']);
        $txt_comments = stripcslashes(htmlspecialchars($_POST['txt_comments'], ENT_NOQUOTES));
        $to = $a['emai'];
        //$to      = '"Ben Vigl [TEST MODE]" <ben@benvigil.com>';
        $subject = 'Found you on AtlantaOccasions.com and would like more information';
        $headers = 'From: "Occasions Magazine Contact Form" <clientcontact@atlantaoccasions.com>' . "\r\n" . 'Reply-To: "Occasions Magazine" <clientcontact@atlantaoccasions.com>' . "\r\n" . 'X-Mailer: AO3/PHP/' . phpversion();
        $msg = 'The following was sent from the Occasions Magazine Contact Form:' . "\r\n\r\n" . 'Name: ' . $txt_name . "\r\n" . 'Email: ' . $txt_email . "\r\n" . 'Phone: ' . $txt_phone . "\r\n" . 'Best Time to Contact: ' . $txt_best . "\r\n" . 'Comment/Details: ' . "\r\n\r\n" . $txt_comments . "\r\n\r\n\r\n" . '------------------------------------------------------------' . "\r\n" . 'SENT TO : ' . $a['emai'] . "\r\n" . 'SENT AT : ' . date("D F j, Y, g:i a") . "\r\n" . 'FROM IP : ' . get_real_ip() . "\r\n" . '------------------------------------------------------------' . "\r\n";
        mail($to, $subject, $msg, $headers);
        mail(AO_ADMIN_EMAIL, $subject, $msg, $headers);
        mail(AO_TECH_EMAIL, $subject, $msg, $headers);
        echo <<<HEREDOC
\t<h3>Thank you!</h3>
\t<p>Your email has been sent to {$a['name']}.</p>
\t<p>If you do not receive a response within 24 hours, we suggest giving them a quick call to make sure your email was delivered successfully.</p>
HEREDOC;
    } else {
        echo <<<HEREDOC
\t<p>To contact this business, please fill out the email form below and click "Send Email" and it will be delivered to the appropriate contact person at <b>{$a['name']}</b> immediately. Please provide as much information as possible to ensure a timely response.</p>
\t<form action="./" method="post">
\t\t<div class="pro_contactrow">
\t\t\t<div class="pro_contactlabel"><label for="txt_name">Name:</label></div>
\t\t\t<div class="pro_contacttxt"><input name="txt_name" type="text" size="50" id="txt_name" value="{$txt_name}" /></div>
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:profile.20100929.php

示例12: delAction

 public function delAction()
 {
     $cidArr = daddslashes($this->postVar('cid', ''));
     if (!empty($cidArr)) {
         $delArr = array();
         foreach ($cidArr as $key => $val) {
             $re = $this->channelIncomeSetModel->deleteCICS($val);
             if ($re) {
                 $delArr[] = $val;
             }
         }
         if ($delArr) {
             $logAdd['app'] = $this->_application;
             $logAdd['controller'] = $this->_controller;
             $logAdd['action'] = $this->_action;
             $logAdd['content'] = json_encode($delArr);
             $logAdd['ip'] = get_real_ip();
             $logAdd['operat'] = UNAME;
             $this->operateLogModel->addOpLog($logAdd);
         }
     }
     $this->redirect('', '/admin/channel_income/', 0);
 }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:23,代码来源:channel_income.php

示例13: login

 /**
  * 登录
  */
 public function login($email, $password)
 {
     $model = $this->getUserByMail($email);
     if (!$model) {
         return false;
     }
     $this->salt = $model['salt'];
     $this->password = $model['password'];
     if (!$this->validatePassword($password)) {
         return false;
     }
     $getRealIp = get_real_ip();
     $obj = null;
     if ($this->save(array('id' => $model['id'], 'login_ip' => $getRealIp, 'last_time' => date('Y-m-d H:i:s')))) {
         $uinfo = $this->encrypt(array('uid' => $model['id'], 'uname' => $model['truename'], 'last' => $model['last_time']));
         $ukey = md5($uinfo . self::IHOUSE_KEY);
         $now = time() + self::COOKIE_EXPIRED;
         $host = $_SERVER['HTTP_HOST'];
         $obj = setcookie(self::UINFO, $uinfo, $now, '/', $host) && setcookie(self::UKEY, $ukey, $now, '/', $host) ? $this : null;
         if ($obj) {
             $this->uid = $model['id'];
             $this->uname = $model['truename'];
             $this->is_pause = $model['is_pause'];
             $this->last_time = $model['last_time'];
         }
     }
     return $obj;
 }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:31,代码来源:admin.php

示例14: htmlspecialchars

$txt_name = htmlspecialchars($_POST['txt_name']);
$txt_email = htmlspecialchars($_POST['txt_email']);
$txt_phone = htmlspecialchars($_POST['txt_phone']);
$txt_message = stripcslashes(htmlspecialchars($_POST['txt_message'], ENT_NOQUOTES));
if ($txt_name && $txt_email && $txt_phone && $txt_message) {
    $profile = new Pod('vendor_profiles');
    $profile->findRecords('id', -1, "t.id = '{$pid}'");
    //$profile->findRecords( 'id', $pid);
    $total = $profile->getTotalRows();
    if ($total > 0) {
        $profile->fetchRecord();
        $a = get_vendorfields($profile);
        $to = $a['emai'];
        $subject = 'Found you on OccasionsOnline.com Mobile (' . $txt_name . ')';
        $headers = 'From: "Occasions Magazine Contact Form" <clientcontact@occasionsonline.com>' . "\r\n" . 'Reply-To: "Occasions Magazine" <clientcontact@occasionsonline.com>' . "\r\n" . 'X-Mailer: AO5/PHP/' . phpversion();
        $msg = 'The following was sent from the Occasions Magazine Mobile Contact Form:' . "\r\n\r\n" . 'Name: ' . $txt_name . "\r\n" . 'Email: ' . $txt_email . "\r\n" . 'Phone: ' . $txt_phone . "\r\n" . 'Message: ' . "\r\n\r\n" . $txt_message . "\r\n\r\n\r\n" . '------------------------------------------------------------' . "\r\n" . 'SENT TO : ' . $a['name'] . "\r\n" . 'CONTACT : ' . $a['emai'] . "\r\n" . 'SENT AT : ' . date("D F j, Y, g:i a") . "\r\n" . 'FROM IP : ' . get_real_ip() . "\r\n" . '------------------------------------------------------------' . "\r\n";
        mail($to, $subject, $msg, $headers, AO_EMAIL_FLAGS);
        mail(AO_ADMIN_EMAIL, $subject, $msg, $headers, AO_EMAIL_FLAGS);
        mail(AO_TECH_EMAIL, $subject, $msg, $headers, AO_EMAIL_FLAGS);
        $success = true;
    } else {
        $err_msg = "There was an error locating contact information for this vendor. We are sorry for the inconvenience.";
        $err_title = "We Encountered a Problem";
    }
} else {
    $err_msg = "Please be sure to fill in all fields.";
    $err_title = "Almost there...";
}
if ($success) {
    ?>
<div data-role="page" id="contact_results" data-theme="o">
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:profile_mobile_phone.php

示例15: Save

 function Save()
 {
     if (!$this->GetAllowed('EDIT')) {
         return;
     }
     if ($this->CheckExistment()) {
         return;
     }
     $arr = $this->dataset->GetFieldValues(true);
     $arr['timestamp'] = time();
     $arr['user_id'] = "'" . user_id() . "'";
     $arr['ip'] = "'" . get_real_ip() . "'";
     db_insert($this->settings['content'], $arr);
 }
开发者ID:Nazg-Gul,项目名称:gate,代码行数:14,代码来源:01CCList.php


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