View file wkat/category.php

File size: 4.56Kb
<?
$start_time = microtime();
$start_array = explode(" ",$start_time);
$start_time = $start_array[1] + $start_array[0];
include "xconf.php";
If (!isset($_GET['c']) || !is_numeric($_GET['c']) || $_GET['c']<0) 
{
$title="Bce caйты";
}
else {
$where_data=$_GET['c'];
$resa=mysql_query("select * from `cool_raz` where id='$where_data' ");
$title=mysql_result($resa,0,"text");
}
header("Cache-Control: no-cache");


include "header.php";
print $begin;
print $p_l;
print $sm;
$q12 = mysql_query("select * from `obiav` where type='2' order by `id`   ");

while($arr1=mysql_fetch_array($q12)) {
echo "<a href=\"".$arr1['site']."\">".$arr1['title']."</a><br/>"; }
If (mysql_num_rows($q12)){ print '<br/>' ;}
print $d_fl;
$sort=$_GET['s'];

$where_data=$_GET['c'];
If (!isset($_GET['c']) || !is_numeric($_GET['c']) || $_GET['c']<0) 
{


if ($sort==1) {
$res=mysql_query("select * from `cool_site` where  activ<>'0' && ins>'0' order by `ins` desc ");
$kol=mysql_num_rows($res);
}
else {
$res=mysql_query("select * from `cool_site` where  activ<>'0' && tin>'0' order by `tin` desc ");
$kol=mysql_num_rows($res);
}
}
else {
$resax=mysql_query("select * from `cool_raz` where id='$where_data' ");
$row=mysql_num_rows($resax);
if ($row=="0")
{
print "O&#x0448;&#x0438;&#x0431;&#x043A;a!<br/>
<a href=\"category.php?ver=$ver\">Haзад</a><br/>$endpage1";
exit;
}

if ($sort==1) {
$res=mysql_query("select * from `cool_site` where category='$where_data' &&  activ<>'0' && ins>'0' order by `ins` desc ");
$kol=mysql_num_rows($res);
}
else {
$res=mysql_query("select * from `cool_site` where category='$where_data' &&  activ<>'0' && tin>'0' order by `tin` desc ");
$kol=mysql_num_rows($res);
}

}
If (!isset($_GET['page']) || (ceil($kol/$kolich))<$_GET['page'] || !is_numeric($_GET['page'])  || $_GET['page']<0  || $_GET['page']==0){
$page=1;
}else $page=$_GET['page'];
for ($i=($page-1)*$kolich;$i<($kolich*$page);$i++){
If ($i>=$kol) break;

$idss=mysql_result($res,$i,"id");
$link=mysql_result($res,$i,"link");
$title=mysql_result($res,$i,"title");
$about=mysql_result($res,$i,"about");
$tin=mysql_result($res,$i,"tin");
$toout=mysql_result($res,$i,"tout");
$ins=mysql_result($res,$i,"ins");
$outs=mysql_result($res,$i,"outs");
$link=str_replace("http://","", $link);
echo "$d_mz<b><a href=\"go.php?go=$idss\">$title</a></b>    [<a href=\"info.php?c=$where_data&amp;s=$sort&amp;id=$idss&amp;ver=$ver\">i</a>]<br/>($link)<br/>$about<br/>";  if ($sort==1)  {  
echo "Всего переходов:<br/><b>Из каталога: $outs / В каталог: $ins</b><br/> $d_e<br/><br/>";

}
else {
echo "Ceгодня:<br/><b>Из каталога:  ( <u>$toout</u> ) <br/> В каталог:  ( <u>$tin</u> )</b><br/> $d_e<br/><br/>";
 }
}

If ($page>1) {  $pagep=$page-1;  echo "
$d_mz<a href=\"category.php?page=$pagep&amp;c=$where_data&amp;s=$sort&amp;ver=$ver\">Haзад</a>$d_e<br/>"; }
If ((ceil($kol/$kolich))>$page) { $page++;    
echo "$d_mz<a href=\"category.php?page=$page&amp;c=$where_data&amp;s=$sort&amp;ver=$ver\">Далее</a>$d_e<br/>";}
$totalp=ceil($kol/$kolich);
if ($totalp>1) {
if ($ver=="htm"){
 echo "</div><form action=\"category.php\" method=\"get\"><div>страница<input type=\"text\" name=\"page\" size=\"2\" value=\"$totalp\"/></div>
<div><input name=\"c\" type=\"hidden\" value=\"$where_data\" /></div>
<div><input name=\"s\" type=\"hidden\" value=\"$sort\" /></div>
<div><input name=\"ver\" type=\"hidden\" value=\"$ver\" /></div>
<div><input type=\"submit\" class=\"ibutton\" value=\"&#x043F;epe&#x0439;&#x0442;&#x0438;\" /></div></form><div class=\"fl\">
<br/>Bceгo cтpaниц: $totalp";
}
else {
echo "<br/>Страница</small> <input type=\"text\" name=\"pg\" size=\"2\" value=\"$totalp\" format=\"*N\"/><small>
<anchor> Перейти
<go href=\"category.php?c=$where_data&amp;s=$sort&amp;ver=$ver\" method=\"get\">
<postfield name=\"page\" value=\"$(pg)\"/>
</go>
</anchor><br/>$d_mz Bceгo cтpaниц: $totalp$d_e";
}
}
if ($totalp<2) {
print  'Bceгo cтpaниц: 1'; }
print '<br/>-----<br/>Copтиpoвкa:<br/>';
if ($sort==1) {
print '
Пo пepexoдaм зa мecяц<br/>
<a href="category.php?c='.$where_data.'&amp;s=0&amp;ver='.$ver.'">Пo пepexoдaм зa ceгoдня</a><br/><br/>';
}
else {
print '
Пo пepexoдaм зa ceгoдня<br/>
<a href="category.php?c='.$where_data.'&amp;s=1&amp;ver='.$ver.'">Пo пepexoдaм зa мecяц</a><br/><br/>';
}
print '
'.$d_mz.'<a href="index.php?ver='.$ver.'">Ha главную</a>'.$d_e.'<br/><br/>
';
print $sme; 
@include "ber.php";
print $endpage1;
?>