Codice PHP:
$iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
$iml = "*";
$atxt ="";
if($topic[2]=='1')
{
//closed
$atxt = "(X)";
}
if($topic[4]>0)
{
$pltx = "(P)";
}else{
$pltx = "";
}
$tnm = htmlspecialchars($topic[1]);
$nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a><br/>";
}
echo "<br/>";
}
$uid = getuid_sid($sid);
if($view=="new")
{
$ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
}
else if($view=="myps")
{
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
}
else{
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
}
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
if($limit_start<0)$limit_start=0;
if($view=="new")
{
$ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
$topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
}
else if($view=="myps"){
$topics = mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id LIMIT $limit_start, $items_per_page");
}
else{
$topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
}
while($topic = mysql_fetch_array($topics))
{
$nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
$iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
if($nop[0]>24)
{
$iml = "<img src=\"../images/hot.gif\" alt=\"*\"/>";
}
if($topic[4]=='1')
{
$iml = "<img src=\"../images/moved.gif\" alt=\"*\"/>";
}
if($topic[2]=='1')
{
$iml = "<img src=\"../images/closed.gif\" alt=\"*\"/>";
}
if($topic[5]>0)
{
$iml = "<img src=\"../images/poll.gif\" alt=\"*\"/>";
}
$atxt ="";
if($topic[2]=='1')
{
//closed
$atxt = "(X)";
}
$tnm = htmlspecialchars($topic[1]);
echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a><br/>";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=viewfrm&page=$ppage&sid=$sid&fid=$fid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=viewfrm&page=$npage&sid=$sid&fid=$fid&view=$view\">Next»</a>";
}
echo "<br/>$page/$num_pages<br/>";
if($num_pages>2)
{
$rets = "<form action=\"index.php\" method=\"get\">";
$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
$rets .= "</form>";
echo $rets;
}
echo "<br/><br/><b>1 </b><a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>";
$cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
if($cid[0]>0)
{
echo "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&sid=$sid\">Inbox</a><br/>";
echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&sid=$sid\">BuddyList</a><br/>";
echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&sid=$sid\">Chat</a><br/>";
$cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
$cname = htmlspecialchars($cinfo[0]);
echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>";
echo forumlink($sid,9);
}else{
echo "<br/><br/><b>5 </b><a accesskey=\"5\" href=\"inbox.php?action=main&sid=$sid\">Inbox</a><br/>";
echo "<b>6 </b><a accesskey=\"6\" href=\"lists.php?action=buds&sid=$sid\">BuddyList</a><br/>";
echo "<b>7 </b><a accesskey=\"7\" href=\"index.php?action=chat&sid=$sid\">Chat</a><br/>";
$cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
$cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
$cname = htmlspecialchars($cinfo[0]);
echo "<b>8 </b><a accesskey=\"8\" href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>";
echo forumlink($sid,9);
}
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
//////////////////////////////////ONLINE USERS
else if($action=="newtopic")
{
$fid = $_GET["fid"];
if(!canaccess(getuid_sid($sid), $fid))
{
echo "<head>";
echo "<title>New Topic</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
echo "<head>";
echo "<title>New Topic</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<form action=\"genproc.php?action=newtopic&sid=$sid\" method=\"post\">";
echo "Title:<input name=\"ntitle\" maxlength=\"250\"/><br/>";
echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/><br/>";
echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
echo "<input type=\"submit\" value=\"Create\"/>";
echo "</form>";
$fname = getfname($fid);
echo "<br/><br/><b>9 </b><a accesskey=\"9\" href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">$fname</a><br/>";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";