本文整理汇总了PHP中getip函数的典型用法代码示例。如果您正苦于以下问题:PHP getip函数的具体用法?PHP getip怎么用?PHP getip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: slog
/**
* Constructor for this class.
*
* This class manages the user-permissions, login and logout.
* This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user.
*/
function slog()
{
global $config, $scache;
$this->statusdata = array();
$this->ip = getip();
$this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT'));
$spiders = $scache->load('spiders');
$this->bots = $spiders->get();
$this->sid = '';
$this->cookies = false;
$this->cookiedata = array(0, '');
$this->cookielastvisit = 0;
$this->defineGID();
$this->gFields = array('downloadfiles', 'forum', 'posttopics', 'postreplies', 'addvotes', 'attachments', 'edit', 'voting', 'admin', 'gmod', 'guest', 'members', 'profile', 'pdf', 'pm', 'wwo', 'search', 'team', 'usepic', 'useabout', 'usesignature', 'docs');
$this->fFields = array('f_downloadfiles', 'f_forum', 'f_posttopics', 'f_postreplies', 'f_addvotes', 'f_attachments', 'f_edit', 'f_voting');
$this->minFields = array('flood');
$this->maxFields = array();
$this->groups = array();
$this->permissions = array();
$this->querysid = true;
$this->positive = array();
$this->negative = array();
$this->boards = array();
$this->sidload = false;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:class.permissions.php
示例2: slog
/**
* Constructor for this class.
*
* This class manages the user-permissions, login and logout.
* This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user.
*/
function slog () {
global $config, $scache;
$this->statusdata = array();
$this->ip = getip();
$this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT'));
$spiders = $scache->load('spiders');
$this->bots = $spiders->get();
$this->sid = '';
$this->cookies = false;
$this->cookiedata = array(0, '');
$this->defineGID();
$this->groups = array();
$this->permissions = array();
$this->querysid = true;
$this->positive = array();
$this->negative = array();
$this->boards = array();
$this->sidload = false;
$this->change_mid = null;
$data = unserialize(file_get_contents('data/group_fields.php'));
foreach ($data as $key => $values) {
$this->$key = $values;
}
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:class.permissions.php
示例3: add
public function add($array)
{
global $webdb;
$array["ip"] = getip();
$img = upload::img('signature', false);
if (!empty($img)) {
$array['imgurl'] = $img['url'];
}
// if(isset($array['birthday_y']) && isset($array['birthday_m'])&&isset($array['birthday_d'])){
// $array['birthday']=date("Y-m-d",strtotime($array['birthday_y'].'/'.$array['birthday_m'].'/'.$array['birthday_d']));
// }
$array["add_time"] = date("Y-m-d H:i:s");
$array['password'] = md5($array['password']);
/*if(isset($array['is_epaper'])){
if($array['is_epaper']==1){
$epaper=array();
$epaper['email']=$array['email'];
$epaper['is_show']=1;
$epaper['date_added']=date("Y-m-d H:i:s");
if(!$this->checkEpaper($array['email'])){
$webdb->insert($epaper, "`_web_epaper` ");
}else{
$webdb->update($epaper, "_web_epaper", "email='".$array['email']."'");
}
}
}*/
return $this->addData($array);
}
开发者ID:austinliniware,项目名称:tsci-rota,代码行数:29,代码来源:registration.class.php
示例4: guestBookPost
function guestBookPost($intSpamFiler, $intIsSecret)
{
global $DMC, $DBPrefix, $arrSideModule;
$parent = 0;
$_POST['isSecret'] = !empty($_POST['isSecret']) ? $_POST['isSecret'] : 0;
$author = !empty($_POST['username']) ? $_POST['username'] : $_SESSION['username'];
$replypassword = !empty($_POST['replypassword']) ? md5($_POST['replypassword']) : "";
if (!empty($_POST['homepage'])) {
if (strpos(";" . $_POST['homepage'], "http://") < 1) {
$homepage = "http://" . $_POST['homepage'];
} else {
$homepage = $_POST['homepage'];
}
} else {
$homepage = "";
}
$email = !empty($_POST['email']) ? $_POST['email'] : "";
$_POST['bookface'] = !empty($_POST['bookface']) ? $_POST['bookface'] : "face1";
$sql = "insert into " . $DBPrefix . "guestbook(author,password,homepage,email,ip,content,postTime,isSecret,parent,face,isSpam) values('{$author}','{$replypassword}','" . encode($homepage) . "','" . encode($email) . "','" . getip() . "','" . encode($_POST['message']) . "','" . time() . "','" . max(intval($intIsSecret), intval($_POST['isSecret'])) . "','{$parent}','" . substr(encode($_POST['bookface']), 4) . "','" . $intSpamFiler . "')";
//echo $sql;
$DMC->query($sql);
//更新cache
settings_recount("guestbook");
settings_recache();
recentGbooks_recache();
logs_sidebar_recache($arrSideModule);
//保存时间
$_SESSION['replytime'] = time();
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:29,代码来源:guestbook.lib.php
示例5: oauth_login
function oauth_login($config)
{
if (!function_exists("curl_init")) {
echo "<h1>腾讯开放平台提示:请先开启curl支持</h1>";
echo "\n\t\t\t开启php curl函数库的步骤(for windows)<br />\n\t\t\t1).去掉windows/php.ini 文件里;extension=php_curl.dll前面的; /*用 echo phpinfo();查看php.ini的路径*/<br />\n\t\t\t2).把php5/libeay32.dll,ssleay32.dll复制到系统目录windows/下<br />\n\t\t\t3).重启apache<br />\n\t\t\t";
exit;
}
$aConfig = array('appid' => $config['appid'], 'appkey' => $config['appkey'], 'api' => 'get_user_info,add_topic,add_one_blog,add_album,upload_pic,list_album,add_share,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idollist,add_idol,del_idol,get_tenpay_addr');
$sState = md5(date('YmdHis' . getip()));
$_SESSION['state'] = $sState;
$server_name = strtolower($_SERVER['SERVER_NAME']);
$server_port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . (int) $_SERVER['SERVER_PORT'];
$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 1 : 0;
$callback = ($secure ? 'https://' : 'http://') . $server_name . $server_port;
$callback = $callback . url('member/register/callback', array('app' => 'qq'));
$_SESSION['URI'] = $callback;
$aParam = array("response_type" => 'code', "client_id" => $aConfig["appid"], "redirect_uri" => $callback, "scope" => $aConfig["api"], "state" => $sState);
$aGet = array();
foreach ($aParam as $key => $val) {
$aGet[] = $key . '=' . urlencode($val);
}
$sUrl = "https://graph.qq.com/oauth2.0/authorize?";
$sUrl .= join("&", $aGet);
header("location:" . $sUrl);
}
开发者ID:rainbow88,项目名称:hummel,代码行数:25,代码来源:qq.php
示例6: Process
/**
* Функция обновляет статус онлайн пользователя на форуме.
* Перед вызовом всех остальных функций, нужно вызвать Process вначале.
* @param type $cat
* @param type $topic
* @return type
*/
public function Process($cat = '0', $topic = '0')
{
if (!$this->online_process) {
$time = time();
$time2 = $time - $this->AliveStatusTime;
System::database()->Delete('forum_online', "`time` < {$time2}");
$user_ip = getip();
if (System::user()->Auth === true) {
$user_id = System::user()->Get('u_id');
} else {
$user_id = 0;
}
$user_name = System::user()->Get('u_name');
if (!$user_name) {
$user_name = '';
}
$user_level = System::user()->Get('u_level');
$where = "`user_ip`='{$user_ip}'";
System::database()->Select('forum_online', $where);
if (System::database()->NumRows() > 0) {
System::database()->Update('forum_online', "`time`='{$time}',`user_id`='{$user_id}',`user_name`='{$user_name}',`user_level`='{$user_level}',`user_ip`='{$user_ip}',`forum_cat`='{$cat}',`forum_topic`='{$topic}'", $where);
} else {
System::database()->Insert('forum_online', "'{$time}','{$user_id}','{$user_name}','{$user_level}','{$user_ip}','{$cat}','{$topic}'");
}
$this->online_process = true;
}
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:34,代码来源:forum_online.class.php
示例7: myquery
function myquery($query)
{
// fonction permettant d'exŽcuter une requête sql en enregistrant l'erreur s'il y a dans un fichier de log ou si debug = 1
$debug = "0";
list($usec, $sec) = explode(' ', microtime());
//debut du comptage du temps
$querytime_before = (double) $usec + (double) $sec;
$result = mysql_query($query);
list($usec, $sec) = explode(' ', microtime());
// fin de comptage
$querytime_after = (double) $usec + (double) $sec;
$time = $querytime_after - $querytime_before;
// temps passé pour effectuer la requête
if (mysql_errno() || $debug == "1") {
$dt = date("Y-m-d H:i:s (T)");
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . mysql_errno() . "</errornum>\n";
$err .= "\t<errormsg>" . mysql_error() . "</errormsg>\n";
$err .= "\t<errorquery>" . $query . "</errorquery>\n";
$err .= "\t<scriptname>" . $_SERVER["SCRIPT_FILENAME"] . "</scriptname>\n";
$err .= "\t<userip>" . getip() . "</userip>\n";
$err .= "\t<timepast>" . $time . "</timepast>\n";
$err .= "</errorentry>\n\n";
// sauvegarde de l'erreur, et mail si c'est critique
error_log($err, 3, CONFIG_ERRORSFOLDER . "sqlerror.log");
}
return $result;
}
开发者ID:lynch829,项目名称:iTP,代码行数:29,代码来源:_connexion.php
示例8: add
public function add()
{
//关闭数据库缓存
$this->db->cache_off();
$token = $this->input->post('token', TRUE);
$add['neir'] = $this->input->post('neir', TRUE);
$add['neir'] = filter(get_bm($add['neir']));
if (User_BookFun == 0) {
$error = '10000';
} elseif (!isset($_SESSION['gbooktoken']) || $token != $_SESSION['gbooktoken']) {
$error = '10001';
} elseif (empty($add['neir'])) {
$error = '10002';
} else {
$add['uidb'] = isset($_SESSION['cscms__id']) ? intval($_SESSION['cscms__id']) : 0;
$add['cid'] = 1;
$add['ip'] = getip();
$add['addtime'] = time();
$ids = $this->CsdjDB->get_insert('gbook', $add);
if (intval($ids) == 0) {
$error = '10003';
//失败
} else {
//摧毁token
unset($_SESSION['token']);
$error = '10004';
}
}
$data['error'] = $error;
echo json_encode($data);
}
开发者ID:djqhuan,项目名称:CSCMS-v4.0-UTF8,代码行数:31,代码来源:gbook.php
示例9: user_set_user_online
function user_set_user_online()
{
global $allgAr;
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '" . session_id() . "'"), 0)) {
db_query("INSERT INTO prefix_online (sid,uptime,ipa) VALUES ('" . session_id() . "',now(),'" . getip() . "')");
}
$_SESSION['authgfx'] = $allgAr['gfx'];
}
开发者ID:kveldscholten,项目名称:uProfile,代码行数:8,代码来源:user.php
示例10: write
function write($key, $value)
{
$query = mysql_query("select * from `sessions` where `sessionkey`='" . $key . "'", $this->oDB);
if (mysql_num_rows($query) == 0) {
mysql_query("insert into `sessions` set `sessionkey`='" . $key . "',`sessionvalue`='" . $value . "',`sessionip`='" . getip() . "', `sessionexpiry` ='" . date("Y-m-d H:i:s", strtotime("+1800 seconds")) . "'", $this->oDB);
} else {
mysql_query("update `sessions` set `sessionvalue`='" . $value . "',`sessionip`='" . getIp() . "',`sessionexpiry`='" . date("Y-m-d H:i:s", strtotime("+1800 seconds")) . "' where `sessionkey`='" . $key . "'", $this->oDB);
}
}
开发者ID:kissthink,项目名称:ym_oauth,代码行数:9,代码来源:session.php
示例11: __construct
function __construct($get, $post)
{
$this->time = time();
$this->ip = getip();
$this->get = $get;
$this->post = $post;
$this->init_db();
//$this->init_cache();
$this->init_user();
}
开发者ID:keguang,项目名称:php_redis_weibo,代码行数:10,代码来源:controlbase.php
示例12: user_set_user_online
function user_set_user_online()
{
global $allgAr;
if (0 == db_result(db_query('SELECT COUNT(*) FROM `prefix_online` WHERE `sid` = "' . session_id() . '"'), 0)) {
db_query('INSERT INTO `prefix_online` (`sid`,`uptime`,`ipa`) VALUES ("' . session_id() . '", "' . date('Y-m-d H:i:s') . '", "' . getip() . '")');
}
if (!isset($_SESSION['authgfx'])) {
$_SESSION['authgfx'] = $allgAr['gfx'];
}
}
开发者ID:rjdesign,项目名称:Ilch-1.2,代码行数:10,代码来源:user.php
示例13: userlogin
function userlogin()
{
global $SITE_ONLINE;
unset($GLOBALS["CURUSER"]);
$ip = getip();
$nip = ip2long($ip);
/* $res = mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
header("HTTP/1.0 403 Forbidden");
print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n");
die;
}
require_once "cache/bans_cache.php";
if(count($bans) > 0)
{
foreach($bans as $k) {
if($nip >= $k['first'] && $nip <= $k['last']) {
header("HTTP/1.0 403 Forbidden");
print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n");
exit();
}
}
unset($bans);
}
*/
if (!$SITE_ONLINE) {
return;
}
#If not cookie set just use guest account
#Morgan
if (empty($_COOKIE["uid"]) || empty($_COOKIE["pass"])) {
$_COOKIE["uid"] = 4;
$_COOKIE["pass"] = '65c22bd4088400d7dd893291e787b026';
}
$id = 0 + $_COOKIE["uid"];
if (!$id || strlen($_COOKIE["pass"]) != 32) {
return;
}
$res = mysql_query("SELECT * FROM users WHERE id = {$id} AND enabled='yes' AND status = 'confirmed'");
// or die(mysql_error());
$row = mysql_fetch_assoc($res);
if (!$row) {
return;
}
//$sec = hash_pad($row["secret"]);
if ($_COOKIE["pass"] !== $row["passhash"]) {
return;
}
mysql_query("UPDATE users SET last_access='" . TIME_NOW . "', ip=" . sqlesc($ip) . " WHERE id=" . $row["id"]);
// or die(mysql_error());
$row['ip'] = $ip;
$GLOBALS["CURUSER"] = $row;
}
开发者ID:CtrlSystem,项目名称:biotorrents,代码行数:55,代码来源:bittorrent.php
示例14: base
function base(&$get, &$post)
{
$this->time = time();
$this->ip = getip();
$this->get =& $get;
$this->post =& $post;
$this->init_db();
$this->init_cache();
$this->init_user();
$this->checkcode();
$this->banned();
}
开发者ID:source-hunter,项目名称:tipask,代码行数:12,代码来源:base.class.php
示例15: isallowed
function isallowed()
{
$ip = getip();
$aList = array('127.0.0.1', '116.228.220.98');
if (in_array($ip, $aList)) {
return true;
} elseif (substr($ip, 0, 7) == '192.168') {
return true;
} else {
return false;
}
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:12,代码来源:functions.php
示例16: failedloginscheck
function failedloginscheck()
{
global $INSTALLER09;
$total = 0;
$ip = sqlesc(getip());
$res = sql_query("SELECT SUM(attempts) FROM failedlogins WHERE ip={$ip}") or sqlerr(__FILE__, __LINE__);
list($total) = mysql_fetch_row($res);
if ($total >= $INSTALLER09['failedlogins']) {
mysql_query("UPDATE failedlogins SET banned = 'yes' WHERE ip={$ip}") or sqlerr(__FILE__, __LINE__);
stderr("Login Locked!", "You have been <b>Exceeded</b> the allowed maximum login attempts without successful login, therefore your ip address <b>(" . htmlspecialchars($ip) . ")</b> has been locked for 24 hours.");
}
}
开发者ID:CharlieHD,项目名称:U-232-V2,代码行数:12,代码来源:takelogin.php
示例17: Audit
/**
* Добавляет новую запись в лог действий администраторов.
* @param $Action
* @return bool
*/
function Audit($Action)
{
if (System::user()->Auth == false) {
return false;
}
$user_ip = getip();
$user_id = System::user()->Get('u_id');
$date = time();
$Action = SafeEnv($Action, 255, str);
System::database()->Insert('audit', Values('', $user_id, $date, $Action, $user_ip));
return true;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:17,代码来源:audit.php
示例18: base
function base(&$get, &$post)
{
$this->time = time();
$this->ip = getip();
$this->get =& $get;
$this->post =& $post;
$this->init_db();
$this->init_cache();
$this->ask_config = new config();
$this->onlineConfig = getConfig();
// 获取配置文件
$this->check_login();
$this->sys_error_handle();
}
开发者ID:eappl,项目名称:prototype,代码行数:14,代码来源:base.class.php
示例19: pollCollector
function pollCollector($pollID, $voteID, $forwarder)
{
global $NPDS_Prefix;
if ($voteID) {
global $setCookies, $al_id, $al_nom, $dns_verif;
$voteValid = "1";
$result = sql_query("SELECT timeStamp FROM " . $NPDS_Prefix . "poll_desc WHERE pollID='{$pollID}'");
list($timeStamp) = sql_fetch_row($result);
$cookieName = 'poll' . $NPDS_Prefix . $timeStamp;
global ${$cookieName};
if (${$cookieName} == "1") {
$voteValid = "0";
} else {
setcookie("{$cookieName}", "1", time() + 86400);
}
global $user;
if ($user) {
global $cookie;
$user_req = "OR al_uid='{$cookie['0']}'";
} else {
$cookie[0] = "1";
$user_req = '';
}
if ($setCookies == "1") {
$ip = getip();
if ($dns_verif) {
$hostname = "OR al_hostname='" . @gethostbyaddr($ip) . "' ";
} else {
$hostname = "";
}
$sql = "SELECT al_id FROM " . $NPDS_Prefix . "appli_log WHERE al_id='{$al_id}' AND al_subid='{$pollID}' AND (al_ip='{$ip}' " . $hostname . $user_req . ")";
if ($result = sql_fetch_row(sql_query($sql))) {
$voteValid = "0";
}
}
if ($voteValid == "1") {
$ip = getip();
if ($dns_verif) {
$hostname = @gethostbyaddr($ip);
} else {
$hostname = '';
}
sql_query("INSERT INTO " . $NPDS_Prefix . "appli_log (al_id, al_name, al_subid, al_date, al_uid, al_data, al_ip, al_hostname) VALUES ('{$al_id}', '{$al_nom}', '{$pollID}', now(), '{$cookie['0']}', '{$voteID}', '{$ip}', '{$hostname}')");
sql_query("UPDATE " . $NPDS_Prefix . "poll_data SET optionCount=optionCount+1 WHERE (pollID='{$pollID}') AND (voteID='{$voteID}')");
sql_query("UPDATE " . $NPDS_Prefix . "poll_desc SET voters=voters+1 WHERE pollID='{$pollID}'");
}
}
Header("Location: {$forwarder}");
}
开发者ID:npds,项目名称:npds_dune,代码行数:49,代码来源:pollBooth.php
示例20: left
function left()
{
global $INSTALLER09;
$total = 0;
$ip = getip();
$fail = sql_query("SELECT SUM(attempts) FROM failedlogins WHERE ip=" . sqlesc($ip)) or sqlerr(__FILE__, __LINE__);
list($total) = mysqli_fetch_row($fail);
$left = $INSTALLER09['failedlogins'] - $total;
if ($left <= 2) {
$left = "<span style='color:red'>{$left}</span>";
} else {
$left = "<span style='color:green'>{$left}</span>";
}
return $left;
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:15,代码来源:login.php
注:本文中的getip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论