/*
+------------------------------------------------------------------------------+
| ShowMyIP - a plugin by nlstart
|
| Plugin Support Site: e107.webstartinternet.com
|
| For the e107 website system visit http://e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+------------------------------------------------------------------------------+
*/
// Protect the file from direct access
//if(!defined("e107_INIT")){ exit; }
// class2.php is the heart of e107, always include it first to give access to e107 constants and variables
require_once("../../class2.php");
// Get language file (assume that the English language file is always present)
$lan_file = e_PLUGIN."showmyip/languages/".e_LANGUAGE.".php";
include_lan($lan_file);
// Check URL query
if(e_QUERY){
$tmp = explode(".", e_QUERY); // Divide the URL query in separate arrays e.g. locator.php?full.2
$action = $tmp[0]; // e.g. $action = 'full'
$action_id = $tmp[1]; // e.g. $action_id = '2' Currently not used
unset($tmp); // unset the arrays, so next time URL query will be determined as new
}
// use HEADERF for USER PAGES and e_ADMIN."auth.php" for admin pages
require_once(HEADERF);
// The heart of ShowMyIP application goes below this line
function get_showmyip() {
$ip;
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = SHOWMYIP_CORE_01;
return $ip;
}
function get_fullip() {
$full;
// Time stamp
$timestamp = getdate();
$full .= "".SHOWMYIP_CORE_02.": ";
$full .= $timestamp[weekday].", ".$timestamp[month]." ".$timestamp[mday].", ".$timestamp[year]." ".$timestamp[hours].":".$timestamp[minutes].":".$timestamp[seconds]."
";
// Proxy (from IE)
$full .= "".SHOWMYIP_CORE_03.": ";
$proxy=getProxyFromIE();
if(!$proxy)
$full .= SHOWMYIP_CORE_04."
"; // Message: Can't find proxy
else
$full .= $proxy."
";
// Proxy Wikipedia definition
$full .= SHOWMYIP_CORE_05."
";
// Get My GID
if (getmygid()) $full .= "GID: "; // Only shown if there is a value returned
if (getmygid()) $full .= getmygid(); // Only shown if there is a value returned
// Browser (User-Agent)
$full .= "".SHOWMYIP_CORE_06.": ";
$full .= $_SERVER['HTTP_USER_AGENT']."
";
// Host name
$ip_address = get_showmyip();
$hostname = gethostbyaddr($ip_address);
$full .= "".SHOWMYIP_CORE_07.": ";
$full .= $hostname."
";
// PHP Magic quotes setting
$full .= "".SHOWMYIP_CORE_08.": ";
if (get_magic_quotes_gpc() == 0) $full .= SHOWMYIP_CORE_09."
"; // Off
if (get_magic_quotes_gpc() == 1) $full .= SHOWMYIP_CORE_10."
"; // On
// PHP Display errors setting
$full .= "".SHOWMYIP_CORE_11.": ";
if (ini_get('display_errors') == 0) $full .= SHOWMYIP_CORE_09."
"; // Off
if (ini_get('display_errors') == 1) $full .= SHOWMYIP_CORE_10."
"; // On
// PHP Post Max Size
$full .= "".SHOWMYIP_CORE_12.": ";
$full .=ini_get('post_max_size')."
"; // xMb
// PHP Post Max Size in bytes
$full .= "".SHOWMYIP_CORE_13.": ";
$full .=(ini_get('post_max_size')*1024*1024)."
";
return $full;
}
function getProxyFromIE() {
exec("reg query \"HKEY_CURRENT_USER\Software\Microsoft"."\Windows\CurrentVersion\Internet Settings\" /v ProxyEnable",$proxyenable,$proxyenable_status);
exec("reg query \"HKEY_CURRENT_USER\Software\Microsoft"."\Windows\CurrentVersion\Internet Settings\" /v ProxyServer",$proxyserver);
if($proxyenable_status!=0)
return false; // Can't access the registry! Maybe not a M$ user...
else
{
$enabled=substr($proxyenable[4],-1,1);
if($enabled==0)
return false;
else
{
$proxy=ereg_replace("^[ \t]{1,10}ProxyServer\tREG_SZ[ \t]{1,20}","",
$proxyserver[4]);
if(ereg("[\=\;]",$proxy))
{
$proxy=explode(";",$proxy);
foreach($proxy as $i => $v)
{
if(ereg("http",$v))
{
$proxy=str_replace("http=","",$v);
break;
}
}
if(@!ereg("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:"."[0-9]{1,5}$",$proxy))
return false;
else
return $proxy;
}
else
return $proxy;
}
}
}
// Gather the desired results in the variable $text
$ip_address = get_showmyip();
$text .="
".SHOWMYIP_CORE_97." ".$ip_address.""; if ($action == "") { // Inform user about full IP info $text .=" ".SHOWMYIP_CORE_98." "; } if ($action == full) { // Show the full IP info $text .=" ".get_fullip()." "; } $text .=" |