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

Размер файла: 1.94Kb
<?php
#############status
//*Trang*//
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM status"),0);
$display = 3;
$count_pages = ceil($k_post/$display);
$page = (isset($_GET['page']) and is_numeric($_GET['page']) and $_GET['page']>1 and $_GET['page']<=$count_pages) ? $_GET['page'] : 1;
$start = $page*$display-$display;
//*Trang*//

if($k_post==0){
echo "<div class='notic'>Chưa có stt nào</div>";
}

$only="SELECT * FROM status ORDER BY time DESC LIMIT $start,$display;";
$res = mysql_query($only);
while ($status = mysql_fetch_array($res)){

$ch_like = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '".$status['id']."' AND `id_user` = '".$userid."' "),0);
$c_like = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '".$status['id']."' "),0);
$c_cmt = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_cmt` WHERE `id_status` = '".$status['id']."' "),0);
echo '<div class="list1">';
echo ''.user($status['from_id']).' &nbsp;('.time_post($status['time']).')<br />'.smiles(tags($status['text'])).'<br /><br />';

echo '</div>';
echo '<div class="shadow">';
if(!$ch_like){
if(!$c_like){
echo '&nbsp;<a href="/status/like.php?id='.$status['id'].'&like">Like</a>';
}else{
echo '&nbsp;'.$c_like.'&nbsp;<img src="/images/like.gif" />&nbsp;<a href="/status/like.php?id='.$status['id'].'&like">Like</a>';
}
}
else{
if(!$c_like){
echo '&nbsp;<a href="/status/like.php?id='.$status['id'].'&unlike">UnLike</a>';
}else{
echo '&nbsp;'.$c_like.'&nbsp;<img src="/images/like.gif" />&nbsp;<a href="/status/like.php?id='.$status['id'].'&unlike">UnLike</a>';
}

}
echo '&nbsp;&nbsp;<a href="/status/list.php?id='.$status['id'].'">'.($c_cmt == 0? 'Bình Luận':''.$c_cmt.' <img src="/images/chat.gif" /> Bình Luận').'</a></div>';





echo '<br />';
}

if($k_post > 3)
{
echo '<div class="left_bot">';
pages($page,$count_pages,'?page=');
echo '</div>';
}


?>