Просмотр файла top.php

Размер файла: 2.27Kb
<?php
session_name("SESID");
session_start();

$agent = $_SERVER['HTTP_USER_AGENT'];
$mobile=strtok($agent,"/");

// выводим верх страници
include 'verh.php';

$p=@intval($_GET['p']);

$category=@intval($_GET['category']);
list($catname)=mysql_fetch_row(mysql_query("SELECT name FROM inet_category WHERE id='$category'"));
$a = mysql_query("SELECT * FROM `inet_sites` WHERE `category`='".$category."' AND `in`>='1' AND resultat!='off' ORDER BY `in` DESC LIMIT $p,$limit");

echo "<div class=\"main_bottom\" align=\"center\"><b>".$catname."</b>";
echo "</div>  ";

if(mysql_affected_rows() == 0)
{
echo("Сайтов нет.<br />\n");
}
while($site = mysql_fetch_array($a)) {
$id = $site['id'];
$name = $site['name'];
$in = $site['in'];
$out = $site['out'];
$opis = $site['opis'];
$url = $site['url'];





echo "<a href='out.php?id=$id'><b>$name</b></a>";
##

if (file_exists("images/$id.gif")) {echo " <img src='images/$id.gif' alt=''/>";}
if (file_exists("images/$id.jpg")) {echo " <img src='images/$id.jpg' alt=''/>";}
if (file_exists("images/$id.png")) {echo " <img src='images/$id.png' alt=''/>";}
if(@$_SESSION['pass']==$adminpass) {
	echo " <a href='adminka/view.php?id=$id'>[admin]</a>";
}
echo "<br/>$opis<br/>";



echo "<a href='out.php?id=$id'>$url</a><br/>";
##

echo "Переходы: <a href=\"info.php?id=$id\">[stat]</a><br/>
in: $in / out: $out<br/>";
echo "</div><div class=\"b\">";
}



$next = $p+$limit;
$prev = $p-$limit;
if ($p>0) {
echo "<a href=\"top.php?p=$prev&amp;category=$category\">Назад</a>";
}
list($c)=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM inet_sites WHERE category='$category' AND `in`>=1"));
if ($p+$limit<$c) {
echo " <a href=\"top.php?p=$next&amp;category=$category\">Далее</a><br/>";
}

echo "<div class=\"b\" align=\"center\">
Категории:<br/>
<form action='top.php' method='get'><select name='category'>";
$cat=mysql_query("SELECT * FROM inet_category ORDER BY position ASC");
while($category = mysql_fetch_array($cat)) {
echo "<option value=\"".$category['id']."\">".$category['name']."</option>";
}
echo "</select><br/><input type='submit' value='Перейти'/></form>";

echo "</div><div class=\"info\">
&#187;<a href=\"index.php\">На главную</a><br/>";

// выводим низ страници
include 'niz.php';

?>