本文整理汇总了PHP中getUserIP函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserIP函数的具体用法?PHP getUserIP怎么用?PHP getUserIP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserIP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class instantiator
*
* @return captcha
*/
function __construct()
{
global $plugin_is_filter;
if (OFFSET_PATH == 2) {
setOptionDefault('zenphoto_captcha_length', 5);
setOptionDefault('zenphoto_captcha_font_size', 18);
setOptionDefault('zenphoto_captcha_key', sha1($_SERVER['HTTP_HOST'] . 'a9606420399a77387af2a4b541414ee5' . getUserIP()));
setOptionDefault('zenphoto_captcha_string', 'abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ');
}
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:15,代码来源:zpCaptcha.php
示例2: handler
/**
*
* Logs User searches
* @param array $search_statistics the search criteria
* @param string $type 'album', 'image', etc.
* @param bool $success did the search return a result
* @param bool $dynamic was it from a dynamic album
* @param int $iteration count of the filters since the search engine instantiation
*/
static function handler($search_statistics, $type, $success, $dynamic, $iteration)
{
if (!$dynamic) {
// log unique user searches
$store = array('type' => $type, 'success' => $success, 'iteration' => $iteration, 'data' => $search_statistics);
$sql = 'INSERT INTO ' . prefix('plugin_storage') . ' (`type`, `aux`,`data`) VALUES ("search_statistics", ' . db_quote(getUserIP()) . ',' . db_quote(serialize($store)) . ')';
query($sql);
}
return $search_statistics;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:19,代码来源:search_statistics.php
示例3: example_comment_form_defaults
/**
* Adds default values to comment form data
*
* NOTE: the indices available are:
* 'name'
* 'website'
* 'anon'
* 'street'
* 'city'
* 'state'
* 'country'
* 'postal'
* 'private'
*
* @param array $defaults
*/
function example_comment_form_defaults($defaults)
{
// set the web field to the browser IP if it is not otherwise set.
if (empty($defaults['data']['website'])) {
$defaults['data']['website'] = 'http://' . getUserIP();
}
// disable the anonymous and private checkboxes (could also reset the options, but this is an example after all!)
$defaults['data']['anon'] = 0;
$defaults['disabled']['anon'] = ' disabled="disabled"';
$defaults['data']['private'] = 0;
$defaults['disabled']['private'] = ' disabled="disabled"';
return $defaults;
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:29,代码来源:example_comment_form_data.php
示例4: login
/**
* Login
* @return bool
*/
public function login()
{
if ($this->_identity === null) {
$this->_identity = new UserIdentity($this->username, $this->password);
$this->_identity->authenticate();
}
if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
$duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
// 30 days
if (($user = $this->user) !== null) {
$user->saveAttributes(array('login_time' => $user->login_time + 1, 'login_ip' => getUserIP(), 'login_attempts' => NULL));
}
Yii::app()->user->login($this->_identity, $duration);
return true;
}
}
开发者ID:nilojan,项目名称:yii-cms,代码行数:20,代码来源:LoginForm.php
示例5: checkIPBlock
/**
* Check the user IP if we need to ban him
*/
protected function checkIPBlock()
{
// array's of banned IP addresses
$bannedIPS = getParam('ban_ips');
$userIP = getUserIP();
$blockedAddresses = explode("\n", $bannedIPS);
$redirectTo = getParam('ban_ips_redirect_url');
// Check every ip address
if ($bannedIPS && is_array($blockedAddresses) && count($blockedAddresses)) {
if (in_array($userIP, $blockedAddresses)) {
// this is for exact matches of IP address in array
header("Location: " . $redirectTo);
exit;
} else {
// this is for wild card matches
foreach ($blockedAddresses as $ip) {
if (preg_match('~' . $ip . '~', $userIP)) {
header("Location: " . $redirectTo);
exit;
}
}
}
}
}
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:27,代码来源:WebApplication.php
示例6: security_logger_log_setup
/**
* Logs setup actions
* @param bool $success
* @param string $action
* @param string $file
*/
function security_logger_log_setup($success, $action, $txt)
{
list($user, $name) = security_logger_populate_user();
security_logger_loginLogger($success, $user, $name, getUserIP(), $action, 'zp_admin_auth', $txt);
return $success;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:12,代码来源:security-logger.php
示例7: handleOption
function handleOption($option, $currentValue)
{
switch ($option) {
case 'hitcounter_set_defaults':
?>
<script language="javascript" type="text/javascript">
// <!-- <![CDATA[
function hitcounter_defaults() {
$('#hitcounter_ignoreIPList').val('');
$('#hitcounter_ip_button').removeAttr('disabled');
$('#hitcounter_ignoreIPList_enable').removeAttr('checked');
$('#hitcounter_ignoreSearchCrawlers_enable').removeAttr('checked');
$('#hitcounter_searchCrawlerList').val('<?php
echo $this->defaultbots;
?>
');
}
// ]]> -->
</script>
<label><input id="hitcounter_reset_button" type="button" value="<?php
echo gettext('Defaults');
?>
" onclick="hitcounter_defaults();" /></label>
<?php
break;
case 'hitcounter_ignoreIPList':
?>
<input type="hidden" name="<?php
echo CUSTOM_OPTION_PREFIX;
?>
'text-hitcounter_ignoreIPList" value="0" />
<input type="text" size="30" id="hitcounter_ignoreIPList" name="hitcounter_ignoreIPList" value="<?php
echo html_encode($currentValue);
?>
" />
<script language="javascript" type="text/javascript">
// <!-- <![CDATA[
function hitcounter_insertIP() {
if ($('#hitcounter_ignoreIPList').val() == '') {
$('#hitcounter_ignoreIPList').val('<?php
echo getUserIP();
?>
');
} else {
$('#hitcounter_ignoreIPList').val($('#hitcounter_ignoreIPList').val()+',<?php
echo getUserIP();
?>
');
}
$('#hitcounter_ip_button').attr('disabled','disabled');
}
jQuery(window).load(function(){
var current = $('#hitcounter_ignoreIPList').val();
if (current.indexOf('<?php
echo getUserIP();
?>
') < 0) {
$('#hitcounter_ip_button').removeAttr('disabled');
}
});
// ]]> -->
</script>
<label><input id="hitcounter_ip_button" type="button" value="<?php
echo gettext('Insert my IP');
?>
" onclick="hitcounter_insertIP();" disabled="disabled" /></label>
<?php
break;
}
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:70,代码来源:hitcounter.php
示例8: mysql_real_escape_string
$_SESSION['userid'] = $lologin4['ids'];
$_SESSION['username'] = $lologin4['username'];
$_SESSION['status'] = $lologin4['status'];
$_SESSION['team'] = $lologin4['team'];
$_SESSION['readSticky'] = $lologin4['readSticky'];
$_SESSION['acceptedRules'] = $lologin4['acceptedRules'];
$_SESSION['hasLicense'] = $lologin4['hasLicense'];
$_SESSION['transferGesperrt'] = FALSE;
$_SESSION['last_forumneu_anzahl'] = 0;
// LOGIN-LOG ANFANG
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$loginLog_userAgent = mysql_real_escape_string(trim(strip_tags($_SERVER['HTTP_USER_AGENT'])));
} else {
$loginLog_userAgent = '';
}
$loginLog_ip = getUserIP();
if (isset($_COOKIE['uniqueHash'])) {
$loginLog_uniqueHash = mysql_real_escape_string(trim(strip_tags($_COOKIE['uniqueHash'])));
} else {
$loginLog_uniqueHash = $loginLog_ip;
setcookie('uniqueHash', $loginLog_ip, getTimestamp('+30 days'), '/', str_replace('www.', '.', CONFIG_SITE_DOMAIN), FALSE, TRUE);
}
if (!in_array($lologin4['ids'], unserialize(CONFIG_PROTECTED_USERS))) {
$loginLog1 = "INSERT INTO " . $prefix . "loginLog (user, zeit, ip, userAgent, uniqueHash) VALUES ('" . $lologin4['ids'] . "', " . time() . ", '" . $loginLog_ip . "', '" . $loginLog_userAgent . "', '" . $loginLog_uniqueHash . "')";
$loginLog2 = mysql_query($loginLog1);
}
// LOGIN-LOG ENDE
// MAXIMALGEBOT ANFANG
$tageHier = (time() - $lologin4['regdate']) / 86400;
if ($tageHier < 0.08) {
$_SESSION['pMaxGebot'] = 0;
开发者ID:FridgeProduction,项目名称:OpenSoccer,代码行数:31,代码来源:login.php
示例9: mysql_query
$sql2 = mysql_query($sql1);
} else {
$sql1 = "UPDATE " . $prefix . "users SET last_login = 1, last_urlaub_kurz = 0, last_urlaub_lang = 0, last_uagent = '', infotext = '', username = CONCAT('GELOESCHT', id) WHERE ids = '" . $cookie_id . "'";
$sql2 = mysql_query($sql1);
}
$sql11 = "DELETE FROM " . $prefix . "pn WHERE von = '" . $cookie_id . "' OR an = '" . $cookie_id . "'";
$sql12 = mysql_query($sql11);
$sql11 = "DELETE FROM " . $prefix . "freunde WHERE f1 = '" . $cookie_id . "' OR f2 = '" . $cookie_id . "'";
$sql12 = mysql_query($sql11);
$sql11 = "DELETE FROM " . $prefix . "freunde_anfragen WHERE von = '" . $cookie_id . "' OR an = '" . $cookie_id . "'";
$sql12 = mysql_query($sql11);
$howLong1 = "SELECT regdate FROM " . $prefix . "users WHERE ids = '" . $cookie_id . "'";
$howLong2 = mysql_query($howLong1);
if (mysql_num_rows($howLong2) == 1) {
$howLong3 = mysql_fetch_assoc($howLong2);
$wielange1 = "INSERT INTO " . $prefix . "abmeldungen (zeit, username, liga, dabei, ip) VALUES (" . time() . ", '" . $cookie_username . "', '" . $cookie_liga . "', " . intval(time() - $howLong3['regdate']) . ", '" . getUserIP() . "')";
$wielange2 = mysql_query($wielange1);
}
header('Location: /logout.php');
exit;
}
$get_urlaub1 = "SELECT urlaub, email FROM " . $prefix . "users WHERE ids = '" . $cookie_id . "'";
$get_urlaub2 = mysql_query($get_urlaub1);
$get_urlaub3 = mysql_fetch_assoc($get_urlaub2);
$noch_urlaub = $get_urlaub3['urlaub'];
$mailAdresse = $get_urlaub3['email'];
$get_urlaub4 = "SELECT ende FROM " . $prefix . "urlaub WHERE user = '" . $cookie_id . "'";
$get_urlaub5 = mysql_query($get_urlaub4);
if (mysql_num_rows($get_urlaub5) > 0) {
$get_urlaub6 = mysql_fetch_assoc($get_urlaub5);
if ($get_urlaub6['ende'] > time()) {
开发者ID:FridgeProduction,项目名称:OpenSoccer,代码行数:31,代码来源:einstellungen.php
示例10: zp_cookieEncode
/**
*
* Encodes a cookie value tying it to the user IP
* @param $value
*/
function zp_cookieEncode($value)
{
if (IP_TIED_COOKIES) {
return rc4(getUserIP() . HASH_SEED, $value);
} else {
return $value;
}
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:13,代码来源:functions-common.php
示例11: str_replace
<?php
@session_set_cookie_params(3600 * 24 * 14, '/', str_replace('www.', '.', CONFIG_SITE_DOMAIN), false, true);
@session_start();
if (isset($_SESSION['loggedin']) and $_SESSION['loggedin'] == 1) {
$loggedin = $_SESSION['loggedin'];
$cookie_id = $_SESSION['userid'];
$cookie_username = $_SESSION['username'];
$cookie_liga = $_SESSION['liga'];
$cookie_team = $_SESSION['team'];
$cookie_teamname = $_SESSION['teamname'];
$cookie_scout = $_SESSION['scout'];
if (mt_rand(1, 3) == 2) {
// nur bei jedem dritten Seitenaufruf
$last_login1 = "UPDATE " . $prefix . "users SET verwarnt = 0, last_login = " . time();
$last_login1 .= ", last_ip = '" . getUserIP() . "'";
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$last_login1 .= ", last_uagent = '" . mysql_real_escape_string(trim(strip_tags($_SERVER['HTTP_USER_AGENT']))) . "'";
}
if (isset($_COOKIE['uniqueHash'])) {
$last_login1 .= ", last_uniqueHash = '" . mysql_real_escape_string(trim(strip_tags($_COOKIE['uniqueHash']))) . "'";
}
$last_login1 .= " WHERE ids = '" . $cookie_id . "'";
$last_login2 = mysql_query($last_login1);
}
} else {
$loggedin = 0;
$cookie_id = '';
$cookie_username = '';
$cookie_liga = '';
$cookie_team = '';
开发者ID:FridgeProduction,项目名称:OpenSoccer,代码行数:31,代码来源:zzcookie.php
示例12: reportError
function reportError($error = "")
{
global $mail;
global $appname;
// generating message
$message = "An error happened in " . $appname . ":";
$message .= "\n\nTime..... " . date("d.m.Y-H:i", time());
$message .= "\nIP....... http://www.utrace.de/?query=" . getUserIP();
$message .= "\nHeader... " . $_SERVER['HTTP_USER_AGENT'];
$message .= "\nError.... " . $error;
// sending error report by mail to given mail address
$sended = mail($mail, "Error Report " . $appname, $message, "From: " . $appname . " <" . $mail . ">");
// check if mail was being send
if (!$sended) {
return false;
}
return true;
}
开发者ID:rurseekatze,项目名称:OpenRailwayMap,代码行数:18,代码来源:functions.php
示例13: beforeValidate
/**
* Makes sure usernames are lowercase
* (emails by standard can have uppercase letters)
* @return parent::beforeValidate
*/
public function beforeValidate()
{
if ($this->isNewRecord) {
$this->create_time = new CDbExpression('NOW()');
$this->activation_key = $this->generate_activation_key();
}
$this->update_time = new CDbExpression('NOW()');
$this->login_ip = getUserIP();
if (!empty($this->username)) {
$this->username = strtolower($this->username);
}
return parent::beforeValidate();
}
开发者ID:imanifaiz,项目名称:angular-music-db,代码行数:18,代码来源:User.php
示例14: guestLoginLogger
/**
* Logs an attempt for a guest user to log onto the site
* Returns the "success" parameter.
*
* @param bool $success
* @param string $user
* @param string $pass
* @param string $athority what kind of login
* @return bool
*/
function guestLoginLogger($success, $user, $pass, $athority)
{
loginLogger($success, $user, $pass, '', getUserIP(), 'frontend', $athority);
return $success;
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:15,代码来源:filter-login.php
示例15: load_script
/**
*
* Counts the hitcounter for the page/object
* @param string $script
* @param bool $valid will be false if the object is not found (e.g. there will be a 404 error);
* @return string
*/
static function load_script($script, $valid)
{
if ($script && $valid) {
if (getOption('hitcounter_ignoreIPList_enable')) {
$ignoreIPAddressList = explode(',', str_replace(' ', '', getOption('hitcounter_ignoreIPList')));
$skip = in_array(getUserIP(), $ignoreIPAddressList);
} else {
$skip = false;
}
if (getOption('hitcounter_ignoreSearchCrawlers_enable') && !$skip && array_key_exists('HTTP_USER_AGENT', $_SERVER) && ($agent = $_SERVER['HTTP_USER_AGENT'])) {
$botList = explode(',', getOption('hitcounter_searchCrawlerList'));
foreach ($botList as $bot) {
if (stripos($agent, trim($bot))) {
$skip = true;
break;
}
}
}
if (!$skip) {
global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_article, $_zp_current_page, $_zp_current_category;
if (checkAccess()) {
// count only if permitted to access
switch ($_zp_gallery_page) {
case 'album.php':
if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS) && getCurrentPage() == 1) {
$_zp_current_album->countHit();
}
break;
case 'image.php':
if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS)) {
//update hit counter
$_zp_current_image->countHit();
}
break;
case 'pages.php':
if (class_exists('CMS') && !zp_loggedin(ZENPAGE_PAGES_RIGHTS)) {
$_zp_current_page->countHit();
}
break;
case 'news.php':
if (class_exists('CMS') && !zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
if (is_NewsArticle()) {
$_zp_current_article->countHit();
} else {
if (is_NewsCategory()) {
$_zp_current_category->countHit();
}
}
}
break;
default:
if (!zp_loggedin()) {
$page = stripSuffix($_zp_gallery_page);
setOption('Page-Hitcounter-' . $page, getOption('Page-Hitcounter-' . $page) + 1);
}
break;
}
}
}
}
return $script;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:69,代码来源:hitcounter.php
示例16: Copyright
<?php
/*
OpenLinkMap Copyright (C) 2010 Alexander Matheisen
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
See http://wiki.openstreetmap.org/wiki/OpenLinkMap for details.
*/
require_once "functions.php";
$format = $_GET['format'];
$callback = $_GET['callback'];
// request location for api
$position = geoip_record_by_name(getUserIP());
if ($position) {
if ($format == "xml") {
echo xmlPositionOutput($position);
} else {
if ($format == "json") {
echo jsonPositionOutput($position, $callback);
} else {
echo textPositionOutput($position);
}
}
} else {
echo "NULL";
}
// output of position in xml format, given: position in format lat,lon
function xmlPositionOutput($position)
{
if ($position) {
$output = xmlStart("geolocation");
开发者ID:dieterdreist,项目名称:OpenLinkMap,代码行数:31,代码来源:ippos.php
示例17: captcha
/**
* Class instantiator
*
* @return captcha
*/
function captcha()
{
setOptionDefault('zenphoto_captcha_length', 5);
setOptionDefault('zenphoto_captcha_key', sha1($_SERVER['HTTP_HOST'] . 'a9606420399a77387af2a4b541414ee5' . getUserIP()));
setOptionDefault('zenphoto_captcha_string', 'abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ');
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:11,代码来源:zenphoto.php
示例18: suspended
/**
* Checks the suspension list for the ip
* @return boolean
*/
static function suspended()
{
if ($block = getOption('ipBlocker_forbidden')) {
$block = getSerializedArray($block);
if (array_key_exists($ip = getUserIP(), $block)) {
if ($block[$ip] < time() - getOption('ipBlocker_timeout') * 60) {
// cooloff period passed
unset($block[$ip]);
if (count($block) > 0) {
setOption('ipBlocker_forbidden', serialize($block));
} else {
setOption('ipBlocker_forbidden', NULL);
}
} else {
return true;
}
}
}
return false;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:24,代码来源:ipBlocker.php
示例19: getUserIP
function getUserIP()
{
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) {
$addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
return trim($addr[0]);
} else {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
if (isset($_GET['title']) && isset($_GET['des']) && isset($_GET['auto']) && isset($_GET['date'])) {
include "config2.php";
$the_ip = getUserIP();
$result = mysql_query('SELECT UID FROM classes WHERE name="' . $_GET['auto'] . '"');
if (!$result) {
echo 'Could not run query: 0' . mysql_error();
exit;
} else {
$row = mysql_fetch_array($result);
if ($row[0] == "") {
echo "Invalid Class '" . $_GET['auto'] . "'.";
header('Location: add_hw.php?sucsses=0');
} else {
echo "SUCCESS0";
}
}
$result = mysql_query('INSERT INTO homeworks (Title, Description, Date, IP)
VALUES ("' . $_GET['title'] . '","' . $_GET['des'] . '","' . $_GET['date'] . '","' . $the_ip . '")');
开发者ID:HackTuesIDK,项目名称:HomeWorks,代码行数:31,代码来源:add.php
示例20: getXSRFToken
/**
* returns an XSRF token
* @param striong $action
*/
function getXSRFToken($action)
{
global $_zp_current_admin_obj;
return sha1($action . prefix(getUserIP()) . serialize($_zp_current_admin_obj) . session_id());
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:9,代码来源:functions.php
注:本文中的getUserIP函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论