本文整理汇总了PHP中getRealIpAddr函数的典型用法代码示例。如果您正苦于以下问题:PHP getRealIpAddr函数的具体用法?PHP getRealIpAddr怎么用?PHP getRealIpAddr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRealIpAddr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_data
<?php
if (verif_connect(true)) {
/**
* Variables Globales
*/
$ID = user_data('Account_ID');
$Date = date('Y-m-d H:i:s');
$IP = getRealIpAddr();
$Pseudo = logged_data('Account_Pseudo');
init_stat_session();
clear_token();
// => trop brutal...
clear_battle();
debug_log('Account_ID::' . logged_data('Account_ID'));
debug_log('Account_Pseudo::' . logged_data('Account_Pseudo'));
/**
* Vérification des sanctions pour l'utilisateur
*/
$Warning_List = get_db("get_sanction_user", array('Account_ID' => logged_data('Account_ID')));
if (!empty($Warning_List)) {
extract(stripslashes_r($Warning_List));
$message = "Vous avez recu un(e) {$Sanction_Type} de la part de {$Sanction_Transmitter}\\n\\n{$Sanction_Message}";
delete_db('Caranille_Sanctions', array('Sanction_ID' => $Sanction_ID));
}
/*
Mise à jour du compte en temps réel
*/
//get_user($Pseudo);
if (verif_auth()) {
init_equipement_session();
开发者ID:galadie,项目名称:Caranille-RPG,代码行数:31,代码来源:Refresh.php
示例2: log_download
function log_download()
{
$fp = fopen('/home/webadmin/cuke4ninja.com/pdfdownload', 'a');
fwrite($fp, date("F j, Y, g:i a") . "\t" . getRealIpAddr());
fwrite($fp, "\n");
fclose($fp);
}
开发者ID:blowzerr,项目名称:cuke4ninja,代码行数:7,代码来源:download-pdf.php
示例3: log_insert
/** function insert log
------------------------------------------------------------------------ **/
function log_insert($log)
{
require_once 'system/libraries/func.php';
$ip = getRealIpAddr();
$session_id = $this->session->userdata('session_id');
$auth = $this->session->userdata('itlogin_id');
$sql = "INSERT INTO itcore_log (ip,session,auth,description) VALUES(" . $this->db->escape($ip) . "," . $this->db->escape($session_id) . "," . $this->db->escape($auth) . "," . $this->db->escape($log) . ")";
return $this->db->query($sql);
}
开发者ID:ahromi,项目名称:feunisba,代码行数:11,代码来源:model_login.php
示例4: getdatalog
function getdatalog($st, $email)
{
$ip = getRealIpAddr();
putenv("TZ=Asia/Saigon");
$datetime = date("Y-m-d H:i:s");
$date = date("Y-m-d");
$data = array('user' => $email, 'ip' => $ip, 'event' => $st, 'time' => $datetime, 'date' => $date);
return $data;
}
开发者ID:lxthien,项目名称:batdongsan,代码行数:9,代码来源:my_helper.php
示例5: web
function web($q, $start)
{
$json = gethtml("https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" . $q . "&as_q=" . $q . "&userip=" . getRealIpAddr() . "&start=" . $start);
$data = json_decode($json);
foreach ($data->responseData->results as $result) {
$results[] = array('visibleUrl' => $result->visibleUrl, 'url' => $result->url, 'title' => $result->title, 'abstract' => $result->content);
}
return $results;
}
开发者ID:soitun,项目名称:meta,代码行数:9,代码来源:functions.php
示例6: register_request
function register_request()
{
global $prefixe_salt, $suffixe_salt;
extract(addslashes_r(stripslashes_r($_POST)));
$Date = date('Y-m-d H:i:s');
$IP = getRealIpAddr();
$filter = uniqid();
$pswd = password_encode($prefixe_salt . $filter . $suffixe_salt, $Password);
$key = uniqid();
insert_db('Caranille_Accounts', array('Account_Pseudo' => strip_tags($Pseudo), 'Account_Password' => strip_tags($pswd), 'Account_Salt' => $filter, 'Account_Email' => $Email, 'Account_Sexe' => $Sexe, 'Account_Inscription' => $Date, 'Account_Last_IP' => $IP, 'Account_HP_Remaining' => 100, 'Account_Key' => $key, 'Account_valid' => 0, 'Account_Level' => 1, 'Account_Order' => 1, 'Account_Reason' => 'None', 'Account_Status' => "Authorized", 'Account_Access' => "Member", 'Account_Guild_ID' => 0, 'Account_HP_Bonus' => 0, 'Account_MP_Remaining' => 10, 'Account_MP_Bonus' => 0, 'Account_Strength_Bonus' => 0, 'Account_Magic_Bonus' => 0, 'Account_Agility_Bonus' => 0, 'Account_Defense_Bonus' => 0, 'Account_Experience' => 0, 'Account_Golds' => 0, 'Account_Notoriety' => 0, 'Account_Chapter' => 1, 'Account_Mission' => 1, 'Account_Step' => 2));
$user_record = get_db('request_account', $_POST);
return $user_record;
}
开发者ID:galadie,项目名称:Caranille-RPG,代码行数:13,代码来源:Register.php
示例7: gravarLog
public function gravarLog($tipo,$usuario,$instituicao){
$banco = $this->getBancoDados();
if ($tipo == 'ALUNO'){
$query = "INSERT INTO tbl_log_acesso (instituicao, aluno,ip,programa) VALUES (".$instituicao.",".$usuario.",'".getRealIpAddr()."','".$_SERVER["PHP_SELF"]."') ";
if(!$banco->updateSQL($query)) {
#throw new Exception("ERRO AO LOGAR");
}
}
if ($tipo == 'PROFESSOR'){
$query = "INSERT INTO tbl_log_acesso (instituicao, professor,ip,programa) VALUES (".$instituicao.",".$usuario.",'".getRealIpAddr()."','".$_SERVER["PHP_SELF"]."') ";
if(!$banco->updateSQL($query)) {
#throw new Exception("ERRO AO LOGAR");
}
}
}
开发者ID:nowakis,项目名称:TesteNet,代码行数:17,代码来源:class.log.DAO.php
示例8: session_start
<?php
include 'functions.php';
session_start();
// You need to set your own parameters!!
define('MYSQL_SERVER', 'localhost:3306');
define('MYSQL_USER', 'erobin258791_db');
define('MYSQL_DB', 'erobin258791_db');
define('MYSQL_PASSWORD', '7d0H8hWG');
// You'd need to activate it once you have operational system
$GLOBALS['DB'] = mysql_connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD) or die("Cannot connect to the MySQL server: \n" . mysql_error());
mysql_select_db(MYSQL_DB, $GLOBALS['DB']) or die('Cannot select MySQL database');
$HTML['email'] = "";
$HTML['dob'] = "";
foreach ($HTML as $key => &$value) {
$value = utf8HTML(getRequest($key, true, 'post'));
}
$HTML['id'] = "";
$HTML['ip'] = getRealIpAddr();
connect("INSERT INTO project (email, dob, ip) VALUES ('" . $HTML['email'] . "', '" . $HTML['dob'] . "' , '" . $HTML['ip'] . "')");
set_SESSION("id", mysql_insert_id());
set_SESSION("email", $HTML['email']);
set_SESSION("dob", $HTML['dob']);
set_SESSION("ip", $HTML['ip']);
return true;
开发者ID:umairsajid,项目名称:Homeworks,代码行数:25,代码来源:login.php
示例9: ost_ticket_note
$name = $_SESSION['FIRST_NAME'] . " " . $_SESSION['LAST_NAME'];
$qry = "INSERT INTO ost_ticket_note(ticket_id,staff_id,source,title,note,created) VALUES('" . $ticket_id . "','" . $_SESSION['STAFF_ID'] . "','" . $name . "','Ticket Updated by " . $name . "','" . $note . "',NOW())";
$res = mysql_query($qry) or die("Bingo...right?");
}
echo "Update Successful! Wow, you just totally changed that data like a pro.";
mysql_close($link);
}
/* Create a new ticket */
if (isset($_GET['new'])) {
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("pickle");
mysql_select_db(DB_NAME) or die("Dig Doug");
$data = superSanitize($_POST);
require_once 'util.php';
$ticketID = randNumber();
$duedate = explode('/', $data['duedate']);
$qry = "INSERT INTO \n\t\tost_ticket(`ticket_id`, `ticketID`, `dept_id`, `priority_id`, `topic_id`, `staff_id`, `email`, `name`, `subject`, `helptopic`, `phone`, `phone_ext`, `ip_address`, `status`, `source`, `isoverdue`, `isanswered` " . ($data['duedate'] == '' ? "" : ",`duedate`") . ",`created`) \n\t\t VALUES('" . $data['ticket_id'] . "', '" . $ticketID . "', '" . $data['dept_id'] . "', '" . $data['priority_id'] . "', '" . $data['helptopicID'] . "', '" . $data['assigned'] . "', '" . $data['email'] . "', '" . $data['name'] . "', '" . $data['subject'] . "', '" . $data['helptopic'] . "', '" . $data['phone'] . "', '" . $data['phone_ext'] . "', '" . getRealIpAddr() . "', '" . "open" . "', '" . $data['ticket_source'] . "', '" . "0" . "', '" . "0" . "'," . ($data['duedate'] == '' ? "" : " '" . gmdate('Y-m-d H:i:s', mktime(0, 0, 0, $duedate[0], $duedate[1], $duedate[2])) . "', ") . " NOW()) ";
mysql_query($qry) or die("that is a funny joke there bob.");
//update attachments
/* send email here depending on whether alert user or staff is checked */
echo "New Ticket Created Successfully! I just cannot believe you did it SO fast.";
//echo sendMail("[email protected]","[email protected]","Test Message","<p>Are <b>you</b> actually named <em>Ross</em> too!</p>")?"Mail Sent":"Mail Fail";
mysql_close($link);
}
/* Ticket - menu, Edit & New */
if (isset($_GET['menu'])) {
if ($_GET['menu'] == 'new') {
require_once 'auth.php';
require_once 'config.php';
require_once 'scripts.php';
$modules = array('tabs', 'uploader', 'new_ticket', 'datepicker');
//first make up a ticket id for later use
开发者ID:rossnorvell,项目名称:bugbase,代码行数:31,代码来源:ticket.php
示例10: getRealIpAddr
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$filename = addslashes($_SERVER["HTTP_FILENAME"]);
$md5 = addslashes($_SERVER["HTTP_MD5"]);
$chunknumber = addslashes($_SERVER["HTTP_CHUNK"]);
$description = addslashes($_SERVER["HTTP_DESCR"]);
$ip = addslashes(getRealIpAddr());
$link = mysql_connect('mysql-s', 's210915rw', 'HeMySQ15');
if (!$link) {
die('DB connection error: ' . mysql_error());
}
mysql_select_db("s210915_main");
if ($md5) {
echo "Filename: {$filename}\n";
$sql = "SELECT content FROM files WHERE filename = '{$filename}' ORDER BY chunk";
$result = mysql_query($sql) or die("Can't execute query 3");
$digest = hash_init("md5");
$len = 0;
while ($row = mysql_fetch_row($result)) {
$len = $len + strlen($row[0]);
hash_update($digest, $row[0]);
echo "-MD5: " . md5($row[0]) . "\n";
开发者ID:jsyang12,项目名称:sevenzipjbinding,代码行数:31,代码来源:upload.php
示例11: addIPAddress
function addIPAddress($mid)
{
$ip = getRealIpAddr();
$s = mysql_query("SELECT COUNT(*) FROM `IP_Address` WHERE mid = '{$mid}' and userIP='{$ip}'") or die(mysql_error());
$row = mysql_fetch_assoc($s);
$c = $row['COUNT(*)'];
if ($c == 0) {
mysql_query("INSERT INTO `IP_Address` (`mid`,`userIP`) VALUES ('{$mid}','{$ip}')") or die(mysql_error());
} else {
mysql_query("UPDATE `IP_Address` set `time_access` = CURRENT_TIMESTAMP WHERE mid = '{$mid}' and userIP='{$ip}' ") or die(mysql_error());
}
}
开发者ID:nani1441,项目名称:metube,代码行数:12,代码来源:functions.php
示例12: define
// Get a free trial at: http://corp.kaltura.com
// In your Kaltura account, get the partner Id and API Admin Secret from:
// http://www.kaltura.com/index.php/kmc/kmc4#account|integration
define("PARTNER_ID", '1357241');
define("ADMIN_SECRET", '1179e62370a3731977bf9a4c6dba3590');
define("USER_SECRET", '7501bdbfadc96b24828ce542b5c66b7a');
define("PLAYER_UICONF_ID", 27216752);
define("BUY_BUTTON_PLAYER_UICONF_ID", null);
define("PAYPAL_METADATA_PROFILE_ID", 4376762);
define("PAYPAL_CATEGORY_METADATA_PROFILE_ID", 4376772);
define("PAYPAL_USER_METADATA_PROFILE_ID", 4376782);
//Generates a USER ID based on the machine name and IP address.
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
if (isset($_COOKIE['kaypaluserid']) && $_COOKIE['kaypaluserid'] != "") {
$USER_ID = $_COOKIE['kaypaluserid'];
} else {
$expire = time() + 60 * 60 * 24 * 365;
$user = implode('_', explode(':', 'demo_user_' . mt_rand(1, 9999999) . getRealIpAddr()));
setcookie('kaypaluserid', $user, $expire);
$USER_ID = $user;
}
开发者ID:nagyistoce,项目名称:Kaltura-Paid-Content-Gallery-With-Stripe,代码行数:31,代码来源:kalturaConfig.php
示例13: register_admin
function register_admin()
{
global $bdd, $prefixe_salt, $suffixe_salt;
extract(addslashes_r($_POST));
echo "{$Password} === {$Password_Confirm}<br/>";
if ($Password === $Password_Confirm) {
$Date = date('Y-m-d H:i:s');
$IP = getRealIpAddr();
$filter = uniqid();
$pswd = password_encode($prefixe_salt . $filter . $suffixe_salt, $Password);
//echo "saisie : $Password<br/>clé : ($prefixe_salt - $filter - $suffixe_salt)=>crypté : $pswd<br/>";
$decode = password_decode($prefixe_salt . $filter . $suffixe_salt, $pswd);
//echo " ctrl :: $decode <br/>";
insert_db('Caranille_Accounts', array('Account_Pseudo' => $Pseudo, 'Account_Password' => $pswd, 'Account_Salt' => $filter, 'Account_Email' => $Email, 'Account_Last_Connection' => $Date, 'Account_Last_IP' => $IP, 'Account_HP_Remaining' => 100, 'Account_Level' => 1, 'Account_Order' => 1, 'Account_Valid' => 1, 'Account_Reason' => 'None', 'Account_Status' => "Authorized", 'Account_Access' => "Admin", 'Account_ID' => 1, 'Account_Guild_ID' => 0, 'Account_HP_Bonus' => 0, 'Account_MP_Remaining' => 10, 'Account_MP_Bonus' => 0, 'Account_Strength_Bonus' => 0, 'Account_Magic_Bonus' => 0, 'Account_Agility_Bonus' => 0, 'Account_Defense_Bonus' => 0, 'Account_Experience' => 0, 'Account_Golds' => 0, 'Account_Notoriety' => 0, 'Account_Chapter' => 1, 'Account_Mission' => 1));
config_game($Email);
return true;
}
return false;
}
开发者ID:galadie,项目名称:Caranille-RPG,代码行数:19,代码来源:Index.php
示例14: mysql_connect
<?php
$db = mysql_connect('riskhorizontest.cfi8996g68d1.us-east-1.rds.amazonaws.com:3306', 'dbtesting', 'engagement') or die('Could not connect: ' . mysql_error());
mysql_select_db('Risk_Horizon') or die('Could not select database');
// Strings must be escaped to prevent SQL injection attack.
$session_uuid = mysql_real_escape_string($_GET['session_uuid'], $db);
$IPv4 = getRealIpAddr();
$datetime = date("D M j G:i:s T Y");
$email = mysql_real_escape_string($_GET['email'], $db);
$hash = $_GET['hash'];
$secretKey = "engagement";
# Change this value to match the value stored in the client javascript below
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$real_hash = md5($session_uuid . $email . $secretKey);
if ($real_hash == $hash) {
// Send variables for the MySQL database class.
$query = "insert into sessions values ('{$session_uuid}', '{$IPv4}', '{$datetime}', '{$email}');";
$result = mysql_query($query);
} else {
// Failure
// $message = "Subject creation failed";
开发者ID:engagementgamelab,项目名称:EL-Website,代码行数:31,代码来源:addSessions.php
示例15: queue_get_key
function queue_get_key($uid, $queue)
{
global $MC_Queue;
$ip = ip2long(getRealIpAddr());
$timeout = 30;
return $MC_Queue->get("timestamp_key{$uid},{$ip},{$timeout}(orders{$queue})");
}
开发者ID:enikesha,项目名称:v_order,代码行数:7,代码来源:utils.php
示例16: date_default_timezone_set
<?php
include 'verif.inc';
//Los mails incluyen la hora
date_default_timezone_set('America/Argentina/Buenos_Aires');
// Comprobar que viene de Facebook y no de la "web"
$ip_visitante = getRealIpAddr();
// SOLO PARA DEBUGGEAR
// print_r($_POST);
if (isset($_POST["formSubmit"])) {
if (strcmp($_POST["formSubmit"], $_SESSION['secreto'])) {
/* El formulario es asi :
// $form_nombre_apellido = $_POST['nombreapellido'];
// $form_ciudad = $_POST['ciudad'];
// $form_e-mail = $_POST['e-mail'];
// $form_telefono = $_POST['telefono'];
// $form_propuesta = $_POST['propuesta'];
*/
$submitter_info_brute = array($_POST['nombreapellido'], $_POST['ciudad'], $_POST['e-mail'], $_POST['telefono'], $_POST['propuesta']);
$submitter_info = array_map("sano", $submitter_info_brute);
$submitter_info_csv = $submitter_info[0] . ',' . $submitter_info[1] . ',' . $submitter_info[2] . ',' . $submitter_info[3];
/* ------------
Chequeo de errores comunes.
-------------------------------- */
// Si hay algun elemento vacio, es que hubo un error validando la entrada.
if (in_array("", $submitter_info)) {
error_caca("Algun elemento del formulario es erroneo. Final no feliz.");
} else {
//NOMBRE
if (!preg_match('/\\w+/', $submitter_info[0])) {
error_caca('El Nombre ingresado es invalido. Intente nuevamente.');
开发者ID:MarxBro,项目名称:AliKK,代码行数:31,代码来源:submit.php
示例17: getRealIpAddr
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
// Log this login attempt
$username = mysql_real_escape_string(stripslashes($_POST['username']));
$md5password = md5(mysql_real_escape_string(stripslashes($_POST['password'])));
$naive_ip = $_SERVER['REMOTE_ADDR'];
$real_ip = getRealIpAddr();
$query = "INSERT INTO login_attempts (timestamp,username,password,naive_ip," . "real_ip) VALUES (CURRENT_TIMESTAMP,'{$username}','{$md5password}','{$naive_ip}'," . "'{$real_ip}')";
$result = mysql_query($query);
if (!$result) {
echo "<p>Could not write to log: " . htmlspecialchars(mysql_error()) . "</p>";
}
if (check_credentials($username, $md5password)) {
header("location:index.php");
} else {
unset($_SESSION['username']);
unset($_SESSION['password']);
unset($_SESSION['admin']);
unset($_SESSION['user_id']);
header("location:login_failed.php");
}
}
开发者ID:SavanVaghela,项目名称:ai-contest,代码行数:31,代码来源:check_login.php
示例18: gravaProvaCorrigirDAO
public function gravaProvaCorrigirDAO(ProvaRespondida $prova_respondida){
$banco = $this->getBancoDados();
$query = "SELECT tbl_prova_aluno.prova
FROM tbl_prova_aluno
WHERE prova = ".$prova_respondida->getProva()->getId()."
AND aluno = ".$prova_respondida->getAluno()->getId();
$retorno = $banco->executaSQL($query);
if ($banco->numRows($retorno) == 0){
throw new Exception("Erro ao atualizar nota da prova (SQL: $query) ");
}
$query = " UPDATE tbl_prova_aluno SET
nota = ".$prova_respondida->Xnota.",
nota_liberada = ".$prova_respondida->Xnota_liberada."
WHERE prova = ".$prova_respondida->getProva()->getId()."
AND aluno = ".$prova_respondida->getAluno()->getId();
#echo nl2br($query);
if(!$banco->updateSQL($query)) {
throw new Exception("Erro ao atualizar nota PROVA RESPONDIDA. (SQL: $query) ");
}
if (strlen($prova_respondida->getNotaLiberada())>0){
if (getRealIpAddr() != '127.0.0.1' or 1==1){
$prova = $prova_respondida->getProva();
$mail = new PHPMailer();
$body = $mail->getFile('emails/prova_corrigida_aluno.html');
$variaveis = array("{ALUNO}","{PROFESSOR}","{NOME_INSTITUICAO}","{PROVA_TITULO}",'{PROVA_INICIO}','{PROVA_TERMINO}','{PROVA_NOTA}', "{LOGIN}", "{SENHA}");
$valores = array( $nome_aluno,
$prova->getProfessor()->getNome(),
$prova->getDisciplina()->getInstituicao()->getNome(),
$prova->getTitulo(),
$prova->getDataInicio(),
$prova->getDataTermino(),
$prova_respondida->getNota(),
$ra_aluno,
$senha_aluno);
$body = str_replace($variaveis, $valores, $body);
$mail->From = "[email protected]";
$mail->FromName = "TesteNet";
$mail->Subject = "TesteNet - Nova Prova!";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$mail->AddAddress($email_aluno, $nome_aluno);
$mail->AddAddress('[email protected]', 'Suporte TesteNet');
$mail->Send();
}
}
}
开发者ID:nowakis,项目名称:TesteNet,代码行数:53,代码来源:class.prova_respondida.DAO.php
示例19: getCountofWeek
}
return $browserInfo;
//array
}
}
return null;
}
function getCountofWeek($day)
{
$date['first'] = mktime(0, 0, 0, date("m"), date("d", $day) - date("w", $day), date("Y"));
$date['last'] = mktime(0, 0, 0, date("m"), date("d", $day) + (6 - date("w", $day)), date("Y"));
return $date;
}
if (substr_count($_SERVER['HTTP_USER_AGENT'], "Googlebot") == 0) {
if (!isset($_SESSION['counter'])) {
$sql = "insert into counter values('','" . getRealIpAddr() . "',now(),'" . $_SERVER['HTTP_USER_AGENT'] . "')";
$result = mysql_query($sql);
if ($result) {
$sql = "select count(*) as allcounter from counter";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$_SESSION['counter']['allcounter'] = $row['allcounter'];
$sql = "select count(*) as today from counter where DATE(timelogin) = CURDATE()";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$_SESSION['counter']['today'] = $row['today'];
$yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$sql = "select count(*) as yesterday from counter where date(timelogin) like '%" . date('Y-m-d', $yesterday) . "%'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$_SESSION['counter']['yesterday'] = $row['yesterday'];
开发者ID:aile54,项目名称:akachan,代码行数:31,代码来源:counter.php
示例20: header
<?php
header("Access-Control-Allow-Origin: *");
$ip_ = getRealIpAddr();
$miArray = array("ip" => $ip_, "country_code" => ip_info($ip_, "Country Code"), "Country" => ip_info($ip_, "Country"));
print_r(json_encode($miArray));
//{"ip":"201.116.117.173","":"MX","country_name":"México","region_code":"","region_name":"","city":"","zip_code":"","time_zone":"","latitude":19.43,"longitude":-99.13,"metro_code":0}
//echo ip_info(getRealIpAddr(), "Country"); // United States
//echo ip_info(getRealIpAddr(), "Country Code"); // US
//echo ip_info(getRealIpAddr(), "State"); // California
//echo ip_info(getRealIpAddr(), "City"); // Menlo Park
//echo ip_info(getRealIpAddr(), "Address"); // Menlo Park, California, United States
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE)
{
$output = NULL;
if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) {
$ip = $_SERVER["REMOTE_ADDR"];
if ($deep_detect) {
if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) {
开发者ID:jvegaDesFra,项目名称:geoIP,代码行数:31,代码来源:index.php
注:本文中的getRealIpAddr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论