<?php
//*********************/
//Скрипт переписан админом
//http://waufon.ru  Кот      *  Проги для компа и мобил
//Помогал админ
//http://pfc.h2m.ru/ КОСМОС  * Посети непожалееш
//всю эту срань господнюю
//перехуяривали на дыры
//http://rus-waphost.ru/ Nitrix * Супер хост без висов
/*********************/
if ( isset( $url ) && !empty( $url ) )
{
$ltime = time( );
$date = date( "Y-m-d", time( ) );
$url = strtolower( $url );
$q = @mysql_query( @"select * from chat_rating where sitename ='".$url."'" );
if ( @( mysql_affected_rows( ) == 0 ) )
{
if ( preg_match( "/^([a-z,0-9-@#!_])+(\\.([a-z,0-9])+)+$/", $url ) )
{
@mysql_query( @"insert into `chat_rating` values(0,'".$url."','0','0','".@time( )."','".$date."');" );
echo "<div>Ваш сайт <i>{$tlink}</i> добавлен в рейтинг</div><br/>";
}
else
{
echo "<div>Неверно указан адрес сайта!</div><br/>";
}
}
else
{
$mydata = @mysql_fetch_array( @$q );
$oldate = $mydata['mydate'];
$id = $mydata['id'];
$today = $mydata['today'];
$allday = $mydata['allday'];
if ( $date != $oldate )
{
@mysql_query( @"update chat_rating set mydate ='".$date."',today='0' WHERE mydate ='".$oldate."'" );
$today = 0;
}
++$today;
++$allday;
@mysql_query( @"UPDATE `chat_rating` SET `today` = '{$today}', `allday`='{$allday}',`ltime`='{$ltime}' WHERE `id` ='{$id}'" );
}
}
@mysql_query( @"DELETE FROM `chat_rating` WHERE `ltime` < ".( @time( ) - 86400 ).";" );
$q = mysql_query( "select * from `chat_rating` order by today desc limit 5;" );
print "<div align=\"right\">";
while ( $arr = @mysql_fetch_array( @$q ) )
{
$tlink = $arr['sitename'];
echo "<a href=\"http://{$tlink}\"><i>{$tlink}</i></a>[{$arr['today']}/{$arr['allday']}]<br/>";
}
echo "<a href=\"vrat.php\">Далее &#187;&#187;&#187;</a><br/>";
echo "</div><br/><a href=\"{$slink}\"><b>&copy; {$sname}</b></a><br/>";
?>