Файл: world-faces.ru/world-faces.ru/sys/fnc/referals.php
Строк: 8
<?php
if(isset($_SERVER['HTTP_REFERER']) && !eregi( str_replace('.','.',$_SERVER['HTTP_HOST']), $_SERVER['HTTP_REFERER']) && eregi('^https?://', $_SERVER['HTTP_REFERER'])){
$url=eregi_replace('^https?://', NULL, $_SERVER['HTTP_REFERER']);
$url=trim(esc($url));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `referals` WHERE `url` = '".mysql_real_escape_string($url)."'"),0)==0){
mysql_query("INSERT INTO `referals` (`time`, `url`, `count`) VALUES ('".time()."', '".mysql_real_escape_string($url)."', '1')");
}else{
$ref=mysql_fetch_array(mysql_query("SELECT * FROM `referals` WHERE `url` = '".mysql_real_escape_string($url)."' LIMIT 1"));
mysql_query("UPDATE `referals` SET `time` = '$time', `count` = '".($ref['count']+1)."' WHERE `url` = '".mysql_real_escape_string($url)."'");
}
}
?>