<?php
//*********************/
//Скрипт переписан админом
//http://waufon.ru  Кот      *  Проги для компа и мобил
//Помогал админ
//http://pfc.h2m.ru/ КОСМОС  * Посети непожалееш
//всю эту срань господнюю
//перехуяривали на дыры
//http://rus-waphost.ru/ Nitrix * Супер хост без висов
/*********************/
require( "inc/conf.inc.php" );
require( "inc/connect.php" );
echo "<title>Рэйтинг</title>";
echo "<style type=\"text/css\">";
echo "body { font-size: x-small; color: {$tcol}; background-color: {$bcol}}";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol}; text-align: center  }";
echo ".cp { border-style:solid; border-width: 0px; color: {$lcol} ; background-color: {$bcol}; text-align: left }";
echo "</style></head><body>";
switch ( $mod )
{
case "search" :
if ( empty( $do ) )
{
echo "<div>Поиск</div>";
echo "<form method=\"post\" action=\"vrat.php?mod={$mod}\">";
echo "Название сайта:<br/>";
echo "<input type=\"text\" name=\"url\"/><br/>";
echo "<input value=\"Искать\" name=\"do\"  type=\"submit\" class=\"cp\"/>";
echo "</form>";
break;
}
else
{
$url = htmlspecialchars( $url );
$url = addslashes( $url );
$url = trim( $url );
$q = mysql_query( "SELECT * from `chat_rating` WHERE sitename LIKE '%".$url."%' order by id desc limit 10" );
if ( mysql_num_rows( $q ) == 0 )
{
echo "<div>Сайт не найден!</div>";
break;
}
else
{
echo "<div>Результат поиска:</div>";
while ( $rat = @mysql_fetch_array( @$q ) )
{
$tlink = $rat['sitename'];
$uid = $rat['id'];
echo "<b><a href=\"vrat.php?uid={$uid}&amp;mod=view\">[ i ]</a></b>\r{$tlink}<br/>";
}
break;
}
}
case "view" :
$uid = intval( $uid );
$q = mysql_query( "select * from `chat_rating` where id='".$uid."';" );
if ( mysql_num_rows( $q ) == 0 )
{
echo "<div>Такого сайта нет!</div>";
break;
}
else
{
$rat = @mysql_fetch_array( @$q );
$url = $rat['sitename'];
$today = $rat['today'];
$all = $rat['allday'];
echo "<div>Информация о сайте</div>";
echo "Сайт:\r<a href=\"http://{$url}\">{$url}</a><br/>";
echo "Сегодня:\r{$today}<br/>";
echo "Всего:\r{$all}<br/>";
echo "---<br/>";
break;
}
default :
$kol = mysql_query( "select id from `chat_rating` ;" );
$i = mysql_num_rows( $kol );
echo "<div>Всего \r<b>{$i}</b> сайтов.</div>";
if ( empty( $s ) )
{
$s = 0;
}
$s = intval( $s );
if ( $s < 0 )
{
$s = 0;
}
$max = 5;
$p = $s * $max;
$q = mysql_query( "select id,sitename from `chat_rating` order by today desc limit {$p},{$max};" );
while ( $rat = @mysql_fetch_array( @$q ) )
{
$tlink = $rat['sitename'];
$uid = $rat['id'];
echo "http://<b><a href=\"vrat.php?uid={$uid}&amp;mod=view\">{$tlink}</a></b><br/>";
}
echo "<p align=\"center\">";
if ( 0 < $p )
{
print "<a href=\"vrat.php?s=".( $s - 1 )."\">&#171;&#171;&#171;</a>\r";
}
if ( $max + $p < $i )
{
print "<a href=\"vrat.php?s=".( $s + 1 )."\">&#187;&#187;&#187;</a>";
}
echo "</p>";
break;
}
if ( isset( $mod ) )
{
echo "<br/><a href=\"vrat.php\">Назад</a>";
}
echo "<p align=\"center\">";
echo "<a href=\"vrat.php?mod=search\">Поиск</a><br/>";
echo "<a href=\"index.php\">Главная</a>";
echo "</p><p>{$ip}</p></body></html>";
mysql_close( $link );
?>