本文整理汇总了PHP中remote_addr函数的典型用法代码示例。如果您正苦于以下问题:PHP remote_addr函数的具体用法?PHP remote_addr怎么用?PHP remote_addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remote_addr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMsgToOpt
function sendMsgToOpt()
{
foreach ($_POST as $key => $val) {
$_POST[$key] = strip_tags($val);
}
if ($this->system->getConf('comment.verifyCode.msg') == 'on') {
if (md5(trim($_POST['verifyCode'])) != $_COOKIE['RANDOM_CODE']) {
$this->splash('failed', 'back', __('验证码录入错误,请重新输入'));
}
}
$this->_verifyMember(false);
$oMsg =& $this->system->loadModel('resources/shopbbs');
$nOpId = $oMsg->getOpId();
$aTemp = array('subject' => $_POST['subject'], 'msg_from' => empty($_POST['msg_from']) && empty($this->member['member_id']) ? __('游客') : $_POST['msg_from'], 'from_type' => isset($this->member) ? 0 : 2, 'to_type' => 1, 'folder' => 'inbox');
if (!$this->member['member_id']) {
$aTemp['email'] = $_POST['email'];
}
$aTemp['msg_ip'] = remote_addr();
if ($this->system->getConf('system.message.open') == 'on') {
$aTemp['is_sec'] = 'false';
} else {
$aTemp['is_sec'] = 'true';
}
$from = $this->member['member_id'] ? $this->member['member_id'] : 0;
if ($oMsg->sendMsg($from, $nOpId, $_POST['message'], $aTemp)) {
$this->splash('success', $this->system->mkUrl("message", "index"), __('提交成功,请等待管理员回复!'));
} else {
$this->splash('failed', $this->system->mkUrl("message", "index"), __('留言提交失败!'));
}
}
示例2: logit
function logit($r = '', $status = '200')
{
global $siteurl, $prefs, $pretext;
$mydomain = str_replace('www.', '', preg_quote($siteurl, "/"));
$out['uri'] = @$pretext['request_uri'];
$out['ref'] = clean_url(str_replace("http://", "", serverSet('HTTP_REFERER')));
$ip = remote_addr();
$host = $ip;
if (!empty($prefs['use_dns'])) {
// A crude rDNS cache
if ($h = safe_field('host', 'txp_log', "ip='" . doSlash($ip) . "' limit 1")) {
$host = $h;
} else {
// Double-check the rDNS
$host = @gethostbyaddr($ip);
if ($host != $ip and @gethostbyname($host) != $ip) {
$host = $ip;
}
}
}
$out['ip'] = $ip;
$out['host'] = $host;
$out['status'] = $status;
$out['method'] = serverSet('REQUEST_METHOD');
if (preg_match("/^[^\\.]*\\.?{$mydomain}/i", $out['ref'])) {
$out['ref'] = "";
}
if ($r == 'refer') {
if (trim($out['ref']) != "") {
insert_logit($out);
}
} else {
insert_logit($out);
}
}
示例3: process
/**
* @todo register bad login
*/
function process()
{
global $username, $password;
$this->kernel->tpl->set_var('login.error', '');
$this->kernel->tpl->set_var('user.name', '');
if (isset($GLOBALS['logout'])) {
$this->kernel->session->logout();
$this->kernel->user->log('logout');
}
if (isset($GLOBALS['cookie_user_name'])) {
$this->kernel->tpl->set_var('user.name', $GLOBALS['cookie_user_name']);
}
if (isset($GLOBALS['submit'])) {
if (empty($GLOBALS['username']) || empty($GLOBALS['password'])) {
$this->kernel->tpl->set_var('login.error', $this->kernel->lang['login.error.empty']);
} else {
$result = $this->kernel->user->login($username, $password);
if (empty($result)) {
// register bad login
$host = remote_addr();
$this->kernel->tpl->set_var('login.error', $this->kernel->lang['login.error']);
$this->kernel->tpl->set_var('user.name', $username);
} else {
setcookie("cookie_user_name", $username, time() + 360000000, "/");
redirect($GLOBALS['PHP_SELF']);
exit;
}
}
}
$this->kernel->tpl->set_file('login_tpl', MODDIR . 'control/tpl/page.login.html');
return $this->kernel->tpl->process('', 'login_tpl');
}
示例4: dologin
function dologin()
{
if ($this->system->getConf('system.admin_verycode') || $this->system->getConf('system.admin_error_login_times') > $this->login_times_error) {
if (strtolower($_POST["verifycode"]) !== strtolower($_SESSION["RANDOM_CODE"])) {
$_SESSION['loginmsg'] = __("验证码输入错误!");
header('Location: index.php?ctl=passport&act=login');
exit;
}
}
$oOpt =& $this->system->loadModel('admin/operator');
$aResult = $oOpt->tryLogin($_POST);
if ($aResult) {
require 'magicvars_sys.php';
$magic =& $this->system->loadModel('system/magicvars');
$now_magic_data = $magic->getList('var_name', '', 0, -1);
$tmp_magic_data = array();
foreach ($now_magic_data as $m_key => $m_value) {
$tmp_magic_data[$m_value['var_name']] = 1;
}
$import_data = array_diff_key($magicvars, $tmp_magic_data);
if ($import_data) {
foreach ($import_data as $me => $i_data) {
$magic->insert($i_data);
}
}
if ($_POST['save_login_name']) {
setcookie("SHOPEX_LOGIN_NAME", $_POST['usrname'], time() + 86400 * 10);
} else {
setcookie("SHOPEX_LOGIN_NAME", "");
}
$log_info['username'] = $_POST['usrname'];
$oOpt->operator_logs('operator', $log_info);
$status =& $this->system->loadModel('system/status');
$lg_key = $this->system->getConf('system.admin_dontlogincheckip') ? md5(remote_addr() . $aResult['op_id']) : md5($aResult['op_id']);
$_SESSION['SHOPEX_LG_KEY'] = $lg_key;
setcookie('SHOPEX_LG_KEY', $lg_key);
$status->update(1);
$this->system->op_id = $aResult['op_id'];
$data['lastlogin'] = time();
$data['logincount'] = $aResult['logincount'] + 1;
$oOpt->setLogInfo($data, $aResult['op_id']);
$this->system->setConf('system.admin_error_login_times', 0);
if ($_REQUEST['return']) {
header("Location: index.php#" . $_REQUEST['return']);
} else {
header("Location: index.php");
}
} else {
if (intval($this->system->getConf('system.admin_error_login_time') + 3600) > time()) {
$this->system->setConf('system.admin_error_login_times', $this->system->getConf('system.admin_error_login_times') + 1);
} else {
$this->system->setConf('system.admin_error_login_times', 1);
}
$this->system->setConf('system.admin_error_login_time', time());
$_SESSION['loginmsg'] = __('用户名或密码错误!');
header('Location: index.php?ctl=passport&act=login');
exit;
}
}
示例5: retry_alias
function retry_alias($ali_name)
{
$params = array('host_id' => '1', 'alias' => $ali_name, 'ip' => remote_addr());
$result = $this->native_svc(SAAS_API_URL, 'alias.retry_alias', $params);
if (!$result) {
$this->debug_msg();
return '域名信息读取失败,请稍候再试。';
}
if ($result['result'] == 'false') {
return $this->msg($result['result_msg']);
}
return true;
}
示例6: dazuiLog
function dazuiLog()
{
$system =& $GLOBALS['system'];
$map = array('date' => date('Y-m-d'), 'worker' => 'shop', 'controller' => isset($system->request['action']['controller']) ? $system->request['action']['controller'] : '-', 'method' => isset($system->request['action']['method']) ? $system->request['action']['method'] : '-', 'query' => isset($system->request['query']) ? $system->request['query'] : '-', 'ip' => remote_addr());
foreach ($map as $k => $v) {
$find[] = '/\\{' . $k . '\\}/i';
}
$this->file = preg_replace($find, $map, LOG_FILE);
if (!is_dir($dir = dirname($this->file))) {
mkdir_p($dir);
}
$this->logStr = create_function('$e', 'return "' . preg_replace(array_merge($find, array('/\\{time\\}/i', '/\\{gmt\\}/i', '/\\{code\\}/i', '/\\{msg\\}/i')), array_merge($map, array('".mydate(\'h:i:s\')."', '[".mydate(\'r\')."]', '".str_pad($e[\'code\'],4,0, STR_PAD_LEFT)."', '".str_replace("\\n",\'\\n\',$e[\'msg\'])."')), str_replace('"', '\\"', LOG_FORMAT)) . '";');
}
示例7: dologin
function dologin()
{
if ($this->system->getConf('system.admin_verycode') || $this->system->getConf('system.admin_error_login_times') > $this->login_times_error) {
if (strtolower($this->in["verifycode"]) !== strtolower($_SESSION["RANDOM_CODE"])) {
$_SESSION['loginmsg'] = __("验证码输入错误!");
header('Location: index.php?ctl=passport&act=login');
exit;
}
}
$oOpt = $this->system->loadModel('admin/operator');
$aResult = $oOpt->tryLogin($_POST);
if ($aResult) {
if ($_POST['save_login_name']) {
setcookie("SHOPEX_LOGIN_NAME", $_POST['usrname'], time() + 86400 * 10);
} else {
setcookie("SHOPEX_LOGIN_NAME", "");
}
$config = unserialize($aResult['config']);
$oOpt->update(array('lastlogin' => time(), 'lastip' => remote_addr(), 'logincount' => $aResult['logincount'] + 1), array('op_id' => $aResult['op_id']));
unset($_SESSION["loginmsg"]);
unset($_SESSION['_PageData']);
unset($_SESSION['OPID']);
unset($_SESSION['SUPER']);
$profile = $this->system->loadModel('adminProfile');
$status = $this->system->loadModel('system/status');
$status->update(1);
$profile->load($aResult['op_id']);
$_SESSION['OPID'] = $aResult['op_id'];
$_SESSION['SUPER'] = $aResult['super'];
$_SESSION['profile'] =& $profile;
$this->system->session->login();
if ($_REQUEST['return']) {
header("Location: index.php#" . $_REQUEST['return']);
} else {
header("Location: index.php");
}
} else {
if (intval($this->system->getConf('system.admin_error_login_time') + 3600) > time()) {
$this->system->setConf('system.admin_error_login_times', $this->system->getConf('system.admin_error_login_times') + 1);
} else {
$this->system->setConf('system.admin_error_login_times', 1);
}
$this->system->setConf('system.admin_error_login_time', time());
$_SESSION['loginmsg'] = __('用户名或密码错误!');
header('Location: index.php?ctl=passport&act=login');
exit;
}
}
示例8: adminPage
/**
* pagefactory
*
* @access public
* @return void
*/
function adminPage()
{
parent::pageFactory();
if (defined('CUSTOM_CORE_DIR') && substr(get_class($this), 0, 4) == 'cct_') {
$this->template_dir = CUSTOM_CORE_DIR . '/admin/view/';
} else {
$this->template_dir = CORE_DIR . '/admin/view/';
}
$this->system =& $GLOBALS['system'];
$this->pagedata = array();
if (DEBUG_TEMPLETE) {
$o =& $this->system->loadModel('system/template');
$theme = $this->system->getConf('system.ui.current_theme');
$o->resetTheme($theme);
}
if (!$this->system->_base_link) {
$this->system->_base_link = $base_url;
if (!$this->system->getConf('system.seo.emuStatic') || $this->system->getConf('system.seo.emuStatic') == 'false') {
$this->system->_base_link .= APP_ROOT_PHP . '?';
}
}
$this->_env_vars = array('base_url' => $this->system->_base_link);
if ($_GET['_ajax']) {
if (!defined('IN_AJAX')) {
define('IN_AJAX', true);
ob_start();
}
} else {
define('IN_AJAX', false);
}
if ($_GET['ctl'] != 'passport') {
$lg_key = $_GET['ctl'] == 'system/comeback' ? $_COOKIE['SHOPEX_LG_KEY'] : $_SESSION['SHOPEX_LG_KEY'];
if (false === $this->system->op_id || $this->system->op_is_disabled || $lg_key != MD5(remote_addr() . $this->system->op_id)) {
$this->notAuth();
} else {
if (!$this->system->op_is_super) {
$oOpt =& $this->system->loadModel('admin/operator', 'config');
if (!$oOpt->check_role($this->system->op_id, $this->workground)) {
$this->system->responseCode(403);
exit;
}
}
}
}
// 是否拥有分销权限 2009-11-20 13:48 wubin
$this->pagedata['distribute'] = $this->system->getConf('certificate.distribute');
}
示例9: run
/**
* shop
*
* @access public
* @return void
*/
function run()
{
if (isset($_GET['gOo'])) {
$urlTools =& $this->loadModel('utility/url');
if ($url = $urlTools->oldVersionShopEx($_GET)) {
$this->compactUrl($url);
}
}
ob_start();
define('IN_SHOP', true);
$_COOKIE = $_COOKIE[COOKIE_PFIX];
$request = $this->parseRequest();
$this->lang = $request['lang'] ? $request['lang'] : DEFAULT_LANG;
$request['money'] = $request['member_lv'] . $request['cur'];
$this->request =& $request;
$GLOBALS['runtime'] = $request;
if (isset($request['member'])) {
foreach ($request['member'] as $k => $v) {
$GLOBALS['runtime'][$k] = $v;
}
}
$cacheAble = !(count($_POST) > 0);
if (defined('BLACKLIST')) {
$blackList = preg_split('/[\\s,]+/', BLACKLIST);
require_once CORE_DIR . '/func_ext.php';
if ($this->match_network($blackList, remote_addr())) {
$this->_succ = true;
header('Connection: close', true, 401);
echo '<h1>Access Denied</h1>';
exit;
}
}
if (isset($_GET['ctl'])) {
$page =& $this->_frontend($request, array('controller' => $_GET['ctl'], 'method' => isset($_GET['act']) ? $_GET['act'] : 'index', 'args' => isset($_GET['p']) ? $_GET['p'] : null));
} elseif (!$cacheAble || !$this->cache->get($ident = implode('|', $request), $page)) {
register_shutdown_function(array(&$this, 'shutdown'));
$this->co_start();
$page =& $this->_frontend($request);
if ($cacheAble && $page['cache']) {
$this->cache->set($ident, $page, $this->co_end());
}
}
$this->display($page);
exit;
}
示例10: logit
/**
* Writes a record to the visitor log using the current visitor's information.
*
* This function is used by log_hit(). See it before trying to use this one.
*
* The hit is ignore if $r is set to 'refer' and the HTTP REFERER header is empty.
*
* @param string $r Type of record to write, e.g. refer
* @param int $status HTTP status code
* @access private
* @see log_hit()
*/
function logit($r = '', $status = 200)
{
global $prefs, $pretext;
if (!isset($pretext['request_uri'])) {
return;
}
$host = $ip = (string) remote_addr();
$protocol = false;
$referer = serverSet('HTTP_REFERER');
if ($referer) {
foreach (do_list(LOG_REFERER_PROTOCOLS) as $option) {
if (strpos($referer, $option . '://') === 0) {
$protocol = $option;
$referer = substr($referer, strlen($protocol) + 3);
break;
}
}
if (!$protocol || $protocol === 'https' && PROTOCOL !== 'https://') {
$referer = '';
} elseif (preg_match('/^[^\\.]*\\.?' . preg_quote(preg_replace('/^www\\./', '', SITE_HOST), '/') . '/i', $referer)) {
$referer = '';
} else {
$referer = $protocol . '://' . clean_url($referer);
}
}
if ($r == 'refer' && !$referer) {
return;
}
if (!empty($prefs['use_dns'])) {
// A crude rDNS cache.
if (($h = safe_field('host', 'txp_log', "ip='" . doSlash($ip) . "' limit 1")) !== false) {
$host = $h;
} else {
// Double-check the rDNS.
$host = @gethostbyaddr($ip);
if ($host !== $ip && @gethostbyname($host) !== $ip) {
$host = $ip;
}
}
}
insert_logit(array('uri' => $pretext['request_uri'], 'ip' => $ip, 'host' => $host, 'status' => $status, 'method' => serverSet('REQUEST_METHOD'), 'ref' => $referer));
}
示例11: toSubmit
function toSubmit($payment)
{
$merId = $this->getConf($payment['M_OrderId'], 'member_id');
$ikey = $this->getConf($payment['M_OrderId'], 'PrivateKey');
$payment['M_Currency'] = "1";
//$order->M_Currency = "1";
$orderdate = date("Ymd", $payment['M_Time']);
//$order->M_Time
$payment['M_Amount'] = number_format($payment['M_Amount'], $this->system->getConf('site.decimal_digit'), ".", "") * 100;
$v_orderid = $merId . $orderdate . substr($payment['M_OrderId'], -10);
$subject = $payment['M_OrderNO'];
$spbill_create_ip = remote_addr();
$bank_type = $payment['payExtend']['bankId'] ? $payment['payExtend']['bankId'] : 0;
$charset = $this->system->loadModel('utility/charset');
$desc = $charset->utf2local($subject, 'zh');
$sp_billno = $charset->utf2local($subject, 'zh');
$str = "cmdno=1&date=" . $orderdate . "&bargainor_id=" . $merId . "&transaction_id=" . $v_orderid . "&sp_billno=" . $sp_billno . "&total_fee=" . $payment['M_Amount'] . "&fee_type=" . $payment['M_Currency'] . "&return_url=" . $this->callbackUrl . "&attach=" . $payment['M_OrderId'] . "&spbill_create_ip=" . $spbill_create_ip . "&key=" . $ikey;
$md5string = strtoupper(md5($str));
$return["cmdno"] = "1";
$return["date"] = $orderdate;
$return["bank_type"] = $bank_type;
$return["desc"] = $subject;
$return["purchaser_id"] = "";
$return["bargainor_id"] = $merId;
$return["transaction_id"] = $v_orderid;
//$payment['M_OrderId'];
$return["sp_billno"] = $payment['M_OrderNO'];
//$order->M_OrderNO;
$return["total_fee"] = $payment['M_Amount'];
//$order->M_Amount;
$return["fee_type"] = $payment['M_Currency'];
//$order->M_Currency;
$return["return_url"] = $this->callbackUrl;
$return["attach"] = $payment['M_OrderId'];
$return["spbill_create_ip"] = $spbill_create_ip;
$return["sign"] = $md5string;
return $return;
}
示例12: create
function create($data)
{
$data['refund_id'] = $this->gen_id();
$data['t_ready'] = time();
$data['t_sent'] = time();
$data['ip'] = remote_addr();
if ($data['pay_type'] == 'deposit') {
//todo预存款
// $this->money=$money;
}
if ($payCfg = $this->db->selectrow('SELECT pay_type,fee,custom_name FROM sdb_payment_cfg WHERE id=' . intval($data['payment']))) {
$data['paycost'] = $payCfg['fee'] * $data['money'];
//$this->bank = $payCfg['pay_type'];
$data['paymethod'] = $payCfg['custom_name'];
}
$rs = $this->db->query('select * from sdb_refunds where 0=1');
$sql = $this->db->getInsertSQL($rs, $data);
if ($this->db->exec($sql)) {
return $data['refund_id'];
} else {
return false;
}
}
示例13: _init
function _init($payment_id)
{
$aPayment = $this->payment->getPaymentById($payment_id);
if ($aPayment['id'] < 1) {
$this->splash('failed', $_SERVER["HTTP_REFERER"], __('支付失败:请选择支付方式!'));
} elseif ($aPayment['pay_type'] == 'offline') {
if ($this->member['member_id']) {
$this->splash('failed', $this->system->mkUrl("member", "orderdetail", array($_POST['order_id'])), __('订单已成功提交了:') . $aPayment['custom_name']);
} else {
$this->splash('failed', $this->system->mkUrl("order", "index", array($_POST['order_id'])), __('订单已成功提交了:') . $aPayment['custom_name']);
}
} else {
if ($aPayment['pay_type'] == 'deposit') {
$this->_verifyMember();
$this->payment->pay_type = 'deposit';
} else {
$this->payment->pay_type = 'online';
}
$this->payment->fee = $aPayment['fee'];
$this->payment->type = $aPayment['pay_type'];
$this->payment->bank = $aPayment['pay_type'];
$aPayment['config'] = unserialize($aPayment['config']);
$this->payment->config = $aPayment['config'];
$this->payment->account = $aPayment['config']['member_id'];
$this->payment->payment = $payment_id;
$this->payment->paymethod = $aPayment['custom_name'];
$this->payment->status = 'ready';
$this->payment->ip = remote_addr();
$this->payment->t_begin = time();
$this->payment->memo = __('会员支付自动生成');
}
}
示例14: basename
// if registration is open log the user in
if ($ps->conf['main']['registration'] == 'open') {
$cms->session->online_status(1, $userinfo['userid']);
}
// display the registration confirmation
$basename = basename(__FILE__, '.php') . '_confirmation';
$cms->theme->add_css('css/forms.css');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer');
exit;
} else {
$ps->db->rollback();
}
}
} else {
if ($ps->conf['main']['uniqueid'] == 'ipaddr') {
$form->set('uniqueid', remote_addr());
}
}
if ($ps->conf['main']['security']['csrf_protection']) {
$cms->session->key($form->key());
}
// assign variables to the theme
$cms->theme->assign(array('errors' => $form->errors(), 'form' => $form->values(), 'uniqueid_label' => $uniqueid_label, 'form_key' => $ps->conf['main']['security']['csrf_protection'] ? $cms->session->key() : ''));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_js('js/forms.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer');
// validator functions --------------------------------------------------------------------------
function password_match($var, $value, &$form)
{
示例15: toReply
function toReply($comment_id)
{
$this->begin('index.php?ctl=goods/discuss&act=detail&p[0]=' . $comment_id);
$objComment =& $this->system->loadModel('comment/comment');
$aComment = $objComment->getFieldById($comment_id, array('*'));
$aData['comment'] = $_POST['reply_content'];
$aData['for_comment_id'] = $comment_id;
$aData['goods_id'] = $aComment['goods_id'];
$aData['object_type'] = $aComment['object_type'];
$aData['author_id'] = $this->system->op_id;
$aData['author'] = __('管理员') . '[' . $this->system->op_name . ']';
$aData['time'] = time();
$aData['lastreply'] = time();
$aData['display'] = 'true';
$aData['ip'] = remote_addr();
$this->end($objComment->toReply($aData), __('回复成功!'));
}