Файл: blogs/top.php
Строк: 50
<?php
require_once ('../shaxty.php');
check_login();
if($_GET['top']=='blogs'){
$title = '10-ка лучших блогов';
$align = 'left';
unset($_SESSION['msg']);
unset($_SESSION['s']);
include_once (H.'shaxty/head.php');
if($level>=5){
if(isset($_GET['delblog'])) {
mysql_query("DELETE FROM `blogs` WHERE tip = 'msg' and id = '".check(intval($_GET['delblog']))."'");
mysql_query("DELETE FROM `blog_komm` where blog = '".check(intval($_GET['delblog']))."'");
header ('Location: ?');
}
}
$k_post=mysql_result(mysql_query("select COUNT(*) from `blogs` WHERE tip = 'msg' and html = 0;"),0);
echo $div4.'<b>10-ка лучших блогов</b>'.$div9;
echo '<dl></dl>';
$order1 = '`yes` DESC ,`no` ASC';
if ($k_post == 0) {
echo "Блогов пока нет<br/>";
} else {
$q2 = mysql_query("select * from `blogs` WHERE tip = 'msg' and html = 0 order by ".$order1." limit 10;");
$d==1;
while($a = mysql_fetch_array($q2)){
$d++;
if(is_integer($d / 2)) echo '<div class="second_name">'; else echo $div2;
$cat=mysql_fetch_array(mysql_query("select * from blogs where tip = 'cat' where `id` = '".$a['refid']."';"));
if($level>=5)$moders = "<a href="/blogs/edit.php?blog=".$a['id']."">[Ред.]</a>|<a href="?delblog=".$a['id']."">[Удал.]</a>";
echo "<img src="img/blog2.png" alt=""/> <b><a href="/blogs/".$a['id']."">".$a['name']."</a></b> (".times($a['time']).") $moders $div9".$a['about']."<br/><img src="img/next.gif" alt=""/> <a href="/blogs/".$a['id']."">Читать полностью</a><dt></dt>
<img src="img/comments.gif" alt=""/> <a href="/blogs/".$a['id']."?komm">Комментарии</a>(".mysql_result(mysql_query("select count(*) as num from blog_komm where `blog` = '".$a['id']."'"),0).")
<br /><img src="img/p2.png" alt=""/> Категория: <a href="cat.php?id=".$cat['id']."">".$cat['name']."</a><br />
<img src="img/ico_inte.png" alt=""/> Автор: ".nik($a['user_id'])."<br />";
if ($a['klych'] != ''){
echo '<img src="img/tag.gif" alt=""/> ';
$record=split(",", $a['klych']);
$num=count($record);
if(!isset($s))$s=1;
$max=round(($num/10)+0.45);
for ($i=0;$i<$num;$i++){
$z++;
$adr=$record[$i];
if($z>0) $zp = ', '; else $zp = '';
echo '<a href="/blogs/search.php?s=key&msg='.$adr.'">'.$adr.'</a>'.$zp;
}
}
echo '<dl></dl>';
}
}
}elseif($_GET['top']=='users'){
$title = '10-ка лучших блогеров';
$align = 'left';
include_once (H.'shaxty/head.php');
$k_post=mysql_result(mysql_query("select COUNT(*) from users;"),0);
echo $div4.'<b>10-ка лучших блогеров</b>'.$div9;
echo '<dl></dl>';
if ($k_post == 0) {
echo "Блогеров пока нет<br/>";
} else {
$q2 = mysql_query("select * from `users` order by postsf desc limit 10;");
$d==1;
while($a = mysql_fetch_array($q2)){
$d++;
if(is_integer($d / 2)) echo '<div class="second_name">'; else echo $div2;
$cat=mysql_fetch_array(mysql_query("select * from blogs where tip = 'cat' and `id` = '".$a['refid']."';"));
$nk= rus_lat(rus_utf_tolower(user_inf($a['id'],'user')));
echo "<img src="img/cascade.png" alt=""/> <a href="us_blogs?id=".$nk."">".user($a['id'])."</a> (".$a['postsf']." блогов)";
echo $div9.'<dl></dl>';
}
}
}
echo '<br />';
echo $div1.'<a href="index.php">Блоги</a>'.$div9;
include_once (H.'shaxty/foot.php');
?>