ANTICHAT — форум по информационной безопасности, OSINT и технологиям
ANTICHAT — русскоязычное сообщество по безопасности, OSINT и программированию.
Форум ранее работал на доменах antichat.ru, antichat.com и antichat.club,
и теперь снова доступен на новом адресе —
forum.antichat.xyz.
Форум восстановлен и продолжает развитие: доступны архивные темы, добавляются новые обсуждения и материалы.
⚠️ Старые аккаунты восстановить невозможно — необходимо зарегистрироваться заново.

06.06.2008, 17:58
|
|
Members of Antichat - Level 5
Регистрация: 09.05.2008
Сообщений: 304
Провел на форуме: 7875940
Репутация:
2362
|
|
И всетаки они разные
PHP код:
<?
header ("Content-type: image/png");
error_reporting(0);
$mysql_host = "";
$mysql_database = "";
$mysql_user = "";
$mysql_password = "";
mysql_connect($mysql_host, $mysql_user, $mysql_password);
mysql_select_db($mysql_database);
$agent = substr($_SERVER['HTTP_USER_AGENT'], 0);
if(preg_match("!(Opera[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "opera";
}
elseif(preg_match("!(Firefox[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "firefox";
}
elseif (preg_match("!MSIE([\s\d\./]+)!msi", $agent, $math))
{
$agent = "Internet Explorer ".$math[1];
$mysqlAgent = "msie";
}
elseif (preg_match("!(Konqueror[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "konqueror";
}
elseif (preg_match("!(Iceweasel[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "iceweasel";
}
elseif (preg_match("!(Lynx[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "lynx";
}
elseif (preg_match("!(Netscape[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "netscape";
}
elseif (preg_match("!(Safari[\s\d\./]+)!msi", $agent, $math))
{
$agent = $math[1];
$mysqlAgent = "safari";
}
if(preg_match("!(Windows\s?[\s\w\.]+)!", $_SERVER['HTTP_USER_AGENT'], $math))
{
$os = $math[1];
if($os == "Windows NT 5.0")
$os = "Windows 2000";
elseif($os == "Windows NT 5.01")
$os = "Windows 2000";
elseif($os == "Windows NT 5.1")
$os = "Windows XP";
elseif($os == "Windows NT 5.2")
$os = "Windows Server 2003";
elseif($os == "Windows NT 6.0")
$os = "Windows Vista";
}
elseif(preg_match("!(Mac\s?OS[\s\w\.]+)!", $_SERVER['HTTP_USER_AGENT'], $math))
$os = $math[1];
elseif(preg_match("!(Symbian\s?OS[\s\w\./]*)!", $_SERVER['HTTP_USER_AGENT'], $math))
$os = $math[1];
elseif(preg_match("!(Linux[\s\w\./]+)!", $_SERVER['HTTP_USER_AGENT'], $math))
$os = $math[1];
elseif(preg_match("!(\w+BSD[\s\w\./]+)!", $_SERVER['HTTP_USER_AGENT'], $math))
$os = $math[1];
elseif(preg_match("!(\J2ME[\s\w\./]+)!", $_SERVER['HTTP_USER_AGENT'], $math))
$os = $math[1];
include("geoip/geoipcity.inc");
include("geoip/geoipregionvars.php");
$gi = geoip_open("geoip/GeoIPCity.dat", GEOIP_MEMORY_CACHE);
$record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
if(!$record->city)
$record->city = "-";
if(!$record->country_name)
$record->country_name = "-";
$height = 42;
$width = 350;
$im = imagecreate($width,$height);
$clblack = ImageColorAllocate($im, 0,0,0);
$clLightGrey = ImageColorAllocate($im, 222,222,222);
$clgrey = ImageColorAllocate($im, 190,190,190);
$clDarkGray = ImageColorAllocate($im, 70,70,70);
for($i = 0; $i < $height; $i++)
{
$color = ImageColorAllocate($im, 100-(100)/$height*$i,100-(100)/$height*$i,100-(100)/$height*$i);
imageline($im,0,$i,$width-1, $i, $color);
}
for($i = 0; $i < $width+$height; $i+=5)
{
imageline($im,$i-$height,0,$i, $height, $clDarkGray);
}
imagerectangle($im, 0, 0, $width - 1 , $height - 1, $clgrey);
$font="mini.ttf";
imagettftext($im, 6, 0, 3, 10, $clgrey, $font, "> Browser:");
imagettftext($im, 6, 0, 70, 10, $clLightGrey, $font, $agent);
imagettftext($im, 6, 0, 3, 17, $clgrey, $font, "> OS:");
imagettftext($im, 6, 0, 70, 17, $clLightGrey, $font, $os);
imagettftext($im, 6, 0, 3, 24, $clgrey, $font, "> IP:");
imagettftext($im, 6, 0, 70, 24, $clLightGrey, $font, $_SERVER['REMOTE_ADDR']);
imagettftext($im, 6, 0, 3, 31, $clgrey, $font, "> Country:");
imagettftext($im, 6, 0, 70, 31, $clLightGrey, $font, $record->country_name);
imagettftext($im, 6, 0, 3, 38, $clgrey, $font, "> City:");
imagettftext($im, 6, 0, 70, 38, $clLightGrey, $font, $record->city);
imagettftext($im, 6, 0, $width-20, 10, $clgrey, $font, "oRb");
ImagePng($im);
geoip_close($gi);
mysql_query("INSERT INTO `useragents` SET `ip`='".$_SERVER['REMOTE_ADDR']."', `browser`='".addslashes($mysqlAgent)."', ".
"`useragent`='".addslashes($_SERVER['HTTP_USER_AGENT'])."', `os`='".addslashes($os)."',".
"`referer`='".addslashes($_SERVER["HTTP_REFERER"])."', `lastupdate`=NOW()".
"ON DUPLICATE KEY UPDATE `browser`='".addslashes($mysqlAgent)."', ".
"`useragent`='".addslashes($_SERVER['HTTP_USER_AGENT'])."', `os`='".addslashes($os)."',".
"`referer`='".addslashes($_SERVER["HTTP_REFERER"])."', `lastupdate`=NOW()");
?>
на хостинг не выкладываю, ибо лень 20 метров в нек кидать. geoip на сайте разработчиков.
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|