Location: PHPKode > projects > CNStats > cnstats/reports/ipinfo.php
<?php if(!defined("ISCNSTATS"))exit;include_once dirname(dirname(__FILE__))."/includes/geo.php";$_00ed2f2f=false;if(isset($COUNTER["geobase"])){if(!empty($COUNTER["geobase"])){$_00ed2f2f=true;$_775ee79c=new cnstats_Geo($COUNTER["geobase"]);}}if(!$_00ed2f2f){$_775ee79c=new cnstats_Geo();}$_7fc45f1d=StripSlashes($_GET["filter"]);$_0cf85b32="&amp;filter=".urlencode($_7fc45f1d)."&amp;robots=".intval($_GET["robots"]);function _1962971e($_a5e3b32d){GLOBAL$LANG;if(substr($_a5e3b32d,0,8)=="192.168.")return($LANG["local ip"]."<br />192.168.0.0 - 192.168.255.255");if(substr($_a5e3b32d,0,3)=="10.")return($LANG["local ip"]."<br />10.0.0.0 - 10.255.255.255");if(substr($_a5e3b32d,0,3)=="14.")return($LANG["local ip"]."<br />14.0.0.0 - 14.255.255.255");if(substr($_a5e3b32d,0,4)=="175.")return($LANG["local ip"]."<br />175.0.0.0 - 175.255.255.255");return(gethostbyaddr($_a5e3b32d));}function _00f77ac0($_a5e3b32d,$_1c375f45=""){GLOBAL$LANG,$_775ee79c;$_01d41b76=$_775ee79c->_a6422cef(ip2long($_a5e3b32d));if($_01d41b76[4]==0){print$_775ee79c->_d2e536b7();}else{list($_7418c594,$_de9d6f86)=explode("|",$_01d41b76[1]);$_5373c966=$_01d41b76[0];$_e408aba0=$_01d41b76[2];$_e408aba0=$_01d41b76[3];$_2d5b0234=$_7418c594;if($LANG["_lang"]=="ru"&&!empty($_de9d6f86))$_2d5b0234=_67c25b2c($_de9d6f86);$_2f2e9874=$_5373c966=chr(($_5373c966>>8)&0xFF).chr($_5373c966&0xFF);}if(!empty($_5373c966)&&$_5373c966!="no"){if(isset($LANG["countrycode"][$_5373c966]))$_5373c966=$LANG["countrycode"][$_5373c966];print"<tr class=\"tbl1\"><td>".$LANG["country"].$_1c375f45."</td><td><img src=\"graph/cicons.php?".strtolower($_2f2e9874).".gif\" width=\"16\" height=\"11\" border=\"0\" hspace=\"4\" />".$_5373c966."</td></tr>\n";}if(!empty($_2d5b0234))print"<tr class=\"tbl1\"><td>".$LANG["city"].$_1c375f45."</td><td>".$_2d5b0234."</td></tr>\n";}function _4dfa685b($_a5e3b32d){GLOBAL$_2472e8fa;$_0275becc=false;unset($_adf3f363);$_2472e8fa["ignore_errors"]=true;if(_51761cca("exec"))@exec("whois ".$_a5e3b32d,$_adf3f363,$_0a9080bb);else$_0275becc=true;$_2472e8fa["ignore_errors"]=false;if(is_array($_adf3f363)){$_adf3f363=implode($_adf3f363,"\r\n");$_adf3f363=trim($_adf3f363);}else$_adf3f363="";if($_0a9080bb==0&&!empty($_adf3f363)&&$_0275becc==false){if(preg_match("/ReferralServer: whois:\/\/([a-z\.]+)/",$_adf3f363,$_6c09ff9d)){$_2472e8fa["ignore_errors"]=true;@exec("whois -h ".$_6c09ff9d[1]." ".$_a5e3b32d,$_57ca2ca6,$_0a9080bb);$_2472e8fa["ignore_errors"]=false;$_57ca2ca6=implode($_57ca2ca6,"\r\n");$_57ca2ca6=trim($_57ca2ca6);if($_0a9080bb==0&&!empty($_57ca2ca6))$_adf3f363=$_57ca2ca6;}print nl2br($_adf3f363);return 0;}if(!_51761cca("fsockopen")){if($_0275becc)return 1;else return 2;}$_70cf0bed=Array("whois.ripe.net"=>"not be in the RIPE database","whois.apnic.net"=>"Not allocated by APNIC","whois.arin.net"=>"ReferralServer","whois.lacnic.net"=>"This network range is not allocated to APNIC");foreach($_70cf0bed as$_e551c011=>$_3bad557f){unset($_adf3f363);$_2472e8fa["ignore_errors"]=true;$_227bafe2=fsockopen($_e551c011,43);if(!$_227bafe2)continue;fwrite($_227bafe2,$_a5e3b32d."\n");while(!feof($_227bafe2))$_adf3f363.=fgets($_227bafe2,128);fclose($_227bafe2);$_2472e8fa["ignore_errors"]=false;if(strpos($_adf3f363,$_3bad557f)!==false)continue;else{print"<b>% Servers: ".$_e551c011."</b><br /><br />";print nl2br($_adf3f363);return 0;}}return 2;}$_56d41083=intval($_GET["rid"]);if(!empty($_56d41083)){$_6c09ff9d=$GLOBALS["cnstats_db"]->_24bdb5eb("select ip,proxy from ".$STATS_CONF["sqlprefix"]."log WHERE id='".$_56d41083."'");if(!$_6c09ff9d)return;if($_e8b7be43=$GLOBALS["cnstats_db"]->_35acb628($_6c09ff9d)){$_a5e3b32d=long2ip($_e8b7be43[0]);$_7372c9be=$_e8b7be43[1]==-1?"":long2ip($_e8b7be43[1]);if(empty($_7372c9be)){$_7372c9be=$LANG["not used"];}else$_7372c9be=$_7372c9be." ("._1962971e($_7372c9be).")";print$SKIN["table_header"];if($_a5e3b32d=="255.255.255.255")print"<tr class=\"tbl2\"><td>".$LANG["ip"]."</td><td>".$LANG["unknownip"]."</td></tr>\n";else{print"<tr class=\"tbl1\"><td>".$LANG["ip"]."</td><td>".$_a5e3b32d."</td></tr>\n";print"<tr class=\"tbl1\"><td>".$LANG["title"]."</td><td>"._1962971e($_a5e3b32d)."</td></tr>\n";}print"<tr class=\"tbl1\"><td>".$LANG["proxy"]."</td><td>".$_7372c9be."</td></tr>\n";$_7372c9be=long2ip($_e8b7be43[1]);$_5373c966=0;_00f77ac0($_a5e3b32d);_00f77ac0($_7372c9be," (".$LANG["proxy"].")");$_e93477b8="<a href=\"#\" onclick=\"ShowFilter('ip','".urlencode($_a5e3b32d)."','log');return false;\"><img src=\"".$SKINDIR."img/ico_log.gif\" border=\"0\" width=\"14\" height=\"12\" title=\"".$LANG["filters creation"]."\" /></a>";if($_a5e3b32d!="255.255.255.255")print"<tr class=\"tbl1\"><td colspan=\"2\">".$_e93477b8."&nbsp;".$_a5e3b32d."</td></tr>\n";print$SKIN["table_header_footer"];$_e8b7be43=array();print$SKIN["table_header"];print"<tr><td class=\"tbl1\" style=\"font-family:courier new;font-size:12px;\">";$_ec3e2afc=$_775ee79c->_4d7cc04a($_a5e3b32d)?$_7372c9be:$_a5e3b32d;$_6c09ff9d=_4dfa685b($_ec3e2afc);if($_6c09ff9d!=0)print"</td></tr><tr><td class=\"tbl1\">".str_replace("%IP%",$_ec3e2afc,$LANG["whois_error"]);if($_6c09ff9d==1)print"<p class=\"hint\">".$LANG["whois security error"]."</p>";print"</td></tr>\n";print$SKIN["table_header_footer"];}else{print$SKIN["table_header"];print"<tr><td>";print$LANG["whois_no_info"];print"</td></tr>\n";print$SKIN["table_header_footer"];}}else{print$SKIN["table_header"];print"<tr><td>";print"No info.";print"</td></tr>\n";print$SKIN["table_header_footer"];}?>
Return current item: CNStats