<?php
echo sprintf("<pre>%s</pre>", print_r($_SERVER, true));
?>
<?php
/*
Sometimes you will find that your website will not get the correct user IP after adding CDN, then this function will help you
*/
function real_ip()
{
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
foreach ($matches[0] AS $xip) {
if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) {
$ip = $xip;
break;
}
}
} elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
} elseif (isset($_SERVER['HTTP_X_REAL_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_X_REAL_IP'])) {
$ip = $_SERVER['HTTP_X_REAL_IP'];
}
return $ip;
}
echo real_ip();
?>
amzn_assoc_placement = "adunit0";
amzn_assoc_tracking_id = "sellingon-20";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_default_search_phrase = "Beauty";
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "8a5aeb9d02c991348d0d037e1d535d71";
amzn_assoc_design = "in_content";
amzn_assoc_title = "Search your favorites but";
Thursday, December 6, 2018
Subscribe to:
Post Comments (Atom)
form validation
function formsubmit ( ) { var empname = document .getElementById ( 'emp_name' ). value ; var email = document .getElem...
-
<!DOCTYPE html> <html> <title>basic encruption example</title> <head> <?php // DEFINE our cipher ...
-
PHP - Sacar XSS function RemoveXSS($val) { $val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); // ...
No comments:
Post a Comment