Файл: whois/index.php
Строк: 66
<?php
$_CONF['title']='WHOIS - IP';
include '../header/config.inc.php';
include '../header/function.inc.php';
include '../header/header.inc.php';
include '../header/connect.inc.php';
include '../header/click-club.class.php';
If (!isset($_GET['log'])) define("anybody","true");
include '../header/enter.inc.php';
include '../ban.php';
If ($_enter){
mysql_query("update `".prefix."users` set `mesto`='Смотрит инфу о своём IP', `online`='".time()."' where `id` = '".$_USER['id']."';");
}
else {
echo '<div class="menuindex"><font color="#FF0000"><b>Вы не авторизированы!</b></font><br/> [ <a href="/enter.php?mode=enter">Войти</a> | <a href="/reg.php">Регистрация</a>]</div>';
}
/*
echo'
<form method="post">
<input type="text" name="ip2" size="15">
<input type="submit" value="Проверить" value="<?= '.htmlspecialchars($_REQUEST['ip2']).'; ?>">
</form>
';
*/
If (!isset($_POST['ip2'])){
$ip2 = $_USER['enterip'];
}
function whois($ip2){
//error_reporting(0);
$url = 'whois.arin.net';
function whois0($url,$ip2)
{
$sock = fsockopen($url, 43, $errno, $errstr);
if (!$sock) exit("$errno($errstr)");
else
{
fputs ($sock, $ip2."rn");
$text = "";
while (!feof($sock))
{
$text .= fgets ($sock, 128)."<br>";
}
fclose ($sock);
$pattern = "|ReferralServer: whois://([^n<:]+)|i";
preg_match($pattern, $text, $out);
if(!empty($out[1])) $rez = whois0($out[1], $ip2);
else $rez = $text;
$rez = eregi_replace( '(.*)<br>inetnum', 'inetnum',$rez);
$rez = eregi_replace( '<br>% Information related(.*)', '<br>',$rez);
return $rez;
}
}
$param1 = 'country:(.*)';
$param2 = '<br>(.*)';
$str0 = whois0($url,$ip2);
$str1 = eregi_replace( '(.*)country:', '',$str0);
$str1 = eregi_replace( '<br>(.*)', '',$str1);
$res5 = eregi_replace( ' ', '',$str1);
$res5 = strtolower($res5);
if(!($res5 ==''))
$res = 'Ваш IP: '.$ip2 .'<br/> Страна: <img src="flags/' .$res5 .'.gif"><br/><br/>' .$str0;
return $res;
}
If (!isset($_POST['ip2'])){
if(!empty($ip2)) echo'<div class="menuindex"> '.whois($ip2).'</div>';
}
else{
if(!empty($_POST['ip2'])) echo'<div class="menuindex"> '. whois($_POST['ip2']).'</div>';
}
include "../header/end.inc.php";
?>