<?php

//WAPSPORT.ORG

//echo "  <div class='p_m'>\n";





$adm_add=NULL;

$adm_add2=NULL;
//echo'<div class="foot">';

echo "<div class='p_m'><b><font color='gray'>&raquo;&#160;Forum update</font></b></div>\n";

//echo '</div>';
if (!isset($user) || $user['level']==0){

$adm_add2=' WHERE';

$q222=mysql_query("SELECT * FROM `forum_f` WHERE `adm` = '1'");

while ($adm_f = mysql_fetch_array($q222)) {

$adm_add[]="`id_forum` <> '$adm_f[id]'";

}

//$adm_add2.=implode(' AND ', $adm_add);

}

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t`$adm_add"),0);

$q=mysql_query("SELECT * FROM `forum_t`$adm_add ORDER BY `time` DESC  LIMIT 3");

if (mysql_num_rows($q)==0) {

//echo "  <div class='p_m'>\n";

echo "<div class='p_m'>post empty</div>\n";

//echo "  </div>\n";

}

while ($them = mysql_fetch_array($q)) {



$forum=mysql_fetch_array(mysql_query("SELECT * FROM `forum_f` WHERE `id` = '$them[id_forum]' LIMIT 1"));

$razdel=mysql_fetch_array(mysql_query("SELECT * FROM `forum_r` WHERE `id` = '$them[id_razdel]' LIMIT 1"));

//echo "  <div class='p_m'>\n";



//echo "  <div class='p_m'>\n";

echo "<div class='p_m'><u>$forum[name]</u> &gt; <u>$razdel[name]</u></div>\n";

$post=mysql_fetch_array(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_razdel` = '$razdel[id]' AND `id_forum` = '$forum[id]' ORDER BY `time` DESC LIMIT 1"));

$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));




//echo "  <div class='status'>\n";
echo"<a href='/info.php?id=$ank[id]' title='\"$ank[nick]\"'>$ank[nick]</a>".online($ank['id'])."\n";



echo "<a href='/forum/$forum[id]/$razdel[id]/$them[id]/'>$them[name]</a>\n";



echo esc(trim(br(bbcode(links(stripcslashes(htmlspecialchars(substr($post['msg'], 0, 56))))))))." ... <font color='green'>(".lama_waktu($post['time']).")</font><br />\n";
echo "<a href='/forum/$forum[id]/$razdel[id]/$them[id]/?page=end'>Read more...</a>";

echo "</div>\n";
}


?>

