stoper, <?php
echo "<table style='width:100%; height:30px' cellspacing='0' cellpadding='0'><tr>";
echo "<td class='title' style='width:35%;border-right:1px solid #29447e'><a href='blog/dir.php'><center>Bo'limlar</a></center></td>";
echo '<td class="title"><a href="?sort=t"><center>Yangilari</a></center></td>';
echo '<td class="title" style="width:35%;border-left:1px solid #29447e"><a href="?sort=c"><center>Dolzarb</a></center></td>';
echo '</tr></table>';
$usearch=NULL;
if (isset($_SESSION['usearch']))$usearch=$_SESSION['usearch'];
if (isset($_POST['usearch']))$usearch=$_POST['usearch'];
if ($usearch==NULL)
unset($_SESSION['usearch']);
else
$_SESSION['usearch']=$usearch;
$usearch=preg_replace("#( ){1,}#","",$usearch);
$order='order by `time` desc';
echo "<form class='mess' method='post' action='/blog/search.php?go'><center>";
$usearch=stripcslashes(htmlspecialchars($usearch));
echo "<input type=\"text\" name=\"usearch\" maxlength=\"16\" value=\"$usearch\" style='width:70%' placeholder='Yangilik nomini kiriting'/>\n";
echo "<input type=\"submit\" value=\"Qidirish\" />";
echo "</center></form>\n";
if (isset($_GET['go'])){
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` where `name` like '%".mysql_real_escape_string($usearch)."%'"
,0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `notes` WHERE `name` like '%".mysql_escape_string($usearch)."%' $order LIMIT $start, $set[p_str]"
;
if ($k_post==0){
echo "<div class='mess'>\n";
echo "Нет записей\n";
echo "</div>\n";
}
$num=0;
while ($post = mysql_fetch_assoc($q)){
echo "<img src='/style/icons/dnev.png' alt='*'> ";
echo "<a href='/blog/list.php?id=$post[id]'>" . htmlspecialchars($post['name']) . "</a> \n";
echo " <span style='time'>(".vremja($post['time'])."
</span>\n";
$k_n= mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `id` = $post[id] AND `time` > '".$ftime."'",$db), 0);
if ($k_n!=0)echo " <img src='/style/icons/new.gif' alt='*'>";
}
if ($k_page>1)str('?go&',$k_page,$page); // Вывод страниц
}
//////////////////////////////////////////////////////
//echo '<div class="mess">';
if (isset($_GET['sort']) && $_GET['sort'] =='t')$order='order by `time` desc';
elseif (isset($_GET['sort']) && $_GET['sort'] =='c') $order='order by `count` desc';
else $order='order by `time` desc';
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` "
,0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `notes` $order LIMIT $start, $set[p_str]"
;
echo "<table class='post'>\n";
if ($k_post==0)
{
echo " <div class='mess'>\n";
echo "Нет записей\n";
echo " </div>\n";
}
while ($post = mysql_fetch_assoc($q)){
echo '<div class="mess">';
echo "<div class='blog_name'><img src='/style/icons/dnev.png' alt='*'> ";
echo '<a href="/blog/list.php?id='.$post['id'].'">'.htmlspecialchars($post['name']).'</a></div>';
$k_n= mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `id` = $post[id] AND `time` > '$ftime'",$db), 0);
$likes = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '1' AND `id_notes` = '".$post['id']."' LIMIT 1"
,0);
echo '<div class="blog">';
echo rez_text(htmlspecialchars($post['msg']))." <a href='/blog/list.php?id=$post[id]'>Batafsil...</a><br />";
echo "(".vremja($post['time'])."
";
echo '<span style="float:right"><img src="/style/icons/bbl5.png" alt="*"/> '.mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_komm` WHERE `id_notes` = '$post[id]'"
,0).' <img src="/style/icons/eye.png"/> '.$post['count'].' <img src="/style/icons/like.gif" alt="*" /> '.$likes.'</span></div>';
echo '</div>';
}
if (isset($_GET['sort'])) $dop="sort=$_GET[sort]&";
else $dop='';
if ($k_page>1)str('?'.$dop.'',$k_page,$page); // Вывод страниц
///////////////////////////////////////////////////
echo '</div>';
?>