here are the codes needed to add a forum to ur site if there are stuff missing just post it here
////////////////////////////////////////////////
core.php
////////////////////////////////////////////////
//////////////////////////////////////////////////////
GENPROC.PHP
//////////////////////////////////////////////////////
////////////////////////////////////////////////////////
INDEX.PHP
////////////////////////////////////////////////////////
////////////////////////////////////////////////
core.php
////////////////////////////////////////////////
Code:
////////////////////////////////////////////Can access forum function canaccess($uid, $fid) { $fex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_forums WHERE id='".$fid."'")); if($fex[0]==0) { return false; } $persc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_acc WHERE fid='".$fid."'")); if($persc[0]==0) { $clid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'")); if($clid[0]==0) { return true; }else{ if(ismod($uid)) { return true; }else{ $ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."'")); if($ismm[0]>0) { return true; }else{ return false; } } } }else{ $gid = mysql_fetch_array(mysql_query("SELECT gid FROM ibwf_acc WHERE fid='".$fid."'")); $gid = $gid[0]; $ginfo = mysql_fetch_array(mysql_query("SELECT autoass, mage, userst, posts, plusses FROM ibwf_groups WHERE id='".$gid."'")); if($ginfo[0]=="1") { $uperms = mysql_fetch_array(mysql_query("SELECT birthday, perm, posts, plusses FROM ibwf_users WHERE id='".$uid."'")); if($ginfo[2]==5) { if(iscoder($uid)) { return true; }else{ return false; } } if($ginfo[2]==4) { if(isheadadmin($uid)) { return true; }else{ return false; } } if($ginfo[2]==3) { if(isowner($uid)) { return true; }else{ return false; } } if($ginfo[2]==2) { if(isadmin($uid)) { return true; }else{ return false; } } if($ginfo[2]==1) { if(ismod($uid)) { return true; }else{ return false; } } if($uperms[1]>$ginfo[2]) { return true; } $acc = true; if(getage($uperms[0])< $ginfo[1]) { $acc = false; } if($uperms[2]<$ginfo[3]) { $acc = false; } if($uperms[3]<$ginfo[4]) { $acc = false; } } } return $acc; } ////////////////get number of pinned topics in forum function getpinned($fid) { $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned ='1'")); return $nop[0]; } ////////////////////////////////////////////Get forum name function getfname($fid) { $fname = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_forums WHERE id='".$fid."'")); return $fname[0]; } ///////////////////////////////////////////Get Forum ID function getfid($topicid) { $fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$topicid."'")); return $fid[0]; } //////////////////////////////////parse bbcode function getbbcode($text, $sid="") { $text = preg_replace("/\[forum\=(.*?)\](.*?)\[\/forum\]/is","<a href=\"index.php?action=viewfrm&tid=$1&sid=$sid\">$2</a>",$text); }
GENPROC.PHP
//////////////////////////////////////////////////////
Code:
if($action=="newtopic") { $fid = $_POST["fid"]; $ntitle = $_POST["ntitle"]; $tpctxt = $_POST["tpctxt"]; if(!canaccess(getuid_sid($sid), $fid)) { $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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 xhtmlfoot(); exit(); } addonline(getuid_sid($sid),"Created New Topic",""); $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); echo "<p align=\"center\">"; $crdate = (time() - $timeadjust) + $timeadjust; //$uid = getuid_sid($sid); $texst = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$ntitle."' AND fid='".$fid."'")); if($texst[0]==0) { $res = false; $ltopic = mysql_fetch_array(mysql_query("SELECT crdate FROM ibwf_topics WHERE authorid='".$uid."' ORDER BY crdate DESC LIMIT 1")); global $topic_af; $antiflood = (time() - $timeadjust)-$ltopic[0] + $timeadjust; if($antiflood>$topic_af) { if((trim($ntitle)!="")||(trim($tpctxt)!="")) { $res = mysql_query("INSERT INTO ibwf_topics SET name='".$ntitle."', fid='".$fid."', authorid='".$uid."', text='".$tpctxt."', crdate='".$crdate."', lastpost='".$crdate."'"); } if($res) { $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'")); $ups = $usts[0]+1; $upl = $usts[1]+1; mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'"); $tnm = htmlspecialchars($ntitle); echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic <b>$tnm</b> Created Successfully"; $tid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_topics WHERE name='".$ntitle."' AND fid='".$fid."'")); echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid[0]\">"; echo "View Topic</a>"; }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Creating New Thread"; } }else{ $af = $topic_af -$antiflood; echo "<img src=\"images/notok.gif\" alt=\"X\"/>Antiflood Control: $af"; } }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic Name already Exist"; } $fname = getfname($fid); echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">"; echo "$fname</a><br/>"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); } else if($action=="rtpc") { $tid = $_GET["tid"]; addonline(getuid_sid($sid),"Reporting Topic",""); $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); echo "<p align=\"center\">"; $pinfo = mysql_fetch_array(mysql_query("SELECT reported FROM ibwf_topics WHERE id='".$tid."'")); if($pinfo[0]=="0") { $str = mysql_query("UPDATE ibwf_topics SET reported='1' WHERE id='".$tid."' "); if($str) { echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic reported to mods successfully"; }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>Can't report topic at the moment"; } }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>This Topic is already reported"; } echo "<br/><br/>"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); } else if($action=="post") { $tid = $_POST["tid"]; $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'")); if(!canaccess(getuid_sid($sid), $tfid[0])) { $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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 "</card>"; echo "</wml>"; exit(); } $reptxt = $_POST["reptxt"]; $qut = $_POST["qut"]; addonline(getuid_sid($sid),"Posted A reply",""); $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); echo "<p align=\"center\">"; $crdate = (time() - $timeadjust) + $timeadjust; $fid = getfid($tid); //$uid = getuid_sid($sid); $res = false; $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'")); if(($closed[0]!='1')||(ismod($uid))) { $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1")); global $post_af; $antiflood = (time() - $timeadjust)-$lpost[0] + $timeadjust; if($antiflood>$post_af) { if(trim($reptxt)!="") { $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'"); } if($res) { $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'")); $ups = $usts[0]+1; $upl = $usts[1]+1; mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'"); mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'"); echo "<img src=\"images/ok.gif\" alt=\"O\"/>Message Posted Successfully"; echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&go=last\">"; echo "View Topic</a>"; }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Posting Message"; } }else{ $af = $post_af -$antiflood; echo "<img src=\"images/notok.gif\" alt=\"X\"/>Antiflood Control: $af"; } }else{ echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic is closed for posting"; } $fname = getfname($fid); echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">"; echo "$fname</a><br/>"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); }
INDEX.PHP
////////////////////////////////////////////////////////
Code:
$var = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Forum Index'")); $var1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Category'")); $var2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Topic'")); $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum'")); $var4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Creating new topic'")); $var5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Posting reply'")); $var6 = $var[0]+$var1[0]+$var2[0]+$var3[0]+$var4[0]+$var5[0]; echo "4 <a accesskey=\"4\" href=\"index.php?action=forumindx&sid=$sid\">$iconforum $lang24 ($var6)</a><br/>"; //////////////////////////////////View category else if($action=="viewcat") { $cid = cleanQuery($_GET["cid"]); addonline(getuid_sid($sid),"Viewing Forum Category","index.php?action=viewcat&cid=$cid"); $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'")); $pstyle = gettheme($sid); echo xhtmlhead($cinfo[0],$pstyle); echo "<body>"; echo "<div align=\"center\">"; echo "<b><i>$cinfo[0]</i></b></div>"; echo "<p align=\"center\">"; echo "<i>This Forum Category Moderate By: </i>"; $mod = "SELECT DISTINCT name FROM ibwf_modr WHERE forum='".$cid."' ORDER BY name"; $itm = mysql_query($mod); echo mysql_error(); if(mysql_num_rows($itm)>0) { while ($it = mysql_fetch_array($itm)) { $who = $it[0]; $user = getnick_uid($who); $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>"; echo "<i>$vulnk,</i>"; }} echo "</p>"; $umsg = getunreadpm(getuid_sid($sid)); if($umsg>0) { echo "<p align=\"center\">"; echo "<br/><a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a>"; echo "</p>"; } $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name"); echo "<p>"; while($forum = mysql_fetch_array($forums)) { $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'")); $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'")); $iml = "<img src=\"../images/1.gif\" alt=\"*\"/>"; echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>"; $lpt = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1")); $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'")); if($nops[0]==0) { $pinfo = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'")); $tluid = $pinfo[0]; }else{ $pinfo = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1")); $tluid = $pinfo[0]; } $tlnm = htmlspecialchars($lpt[1]); $tlnick = getnick_uid($tluid); $tpclnk = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$lpt[0]&go=last\">$tlnm</a>"; $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$tluid\">$tlnick</a>"; if($pinfo[0]>0) { echo "Last Post: $tpclnk<br/>By: $vulnk<br/>"; } } echo "</p>"; echo "<p align=\"center\">"; $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Category'")); echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>"; echo forumlink($sid); echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>"; echo "</p>"; echo "</body>"; echo xhtmlfoot(); exit(); } //////////////////////////////////View Topic155 else if($action=="viewtpc") { $tid = cleanQuery($_GET["tid"]); $go = cleanQuery($_GET["go"]); addonline(getuid_sid($sid),"Viewing Forum Topic","index.php?action=viewtpc&tid=$tid"); $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'")); if(!canaccess(getuid_sid($sid), $tfid[0])) { $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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(); } $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'")); $tnm = htmlspecialchars($tinfo[0]); $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); echo "<body>"; echo "<div align=\"center\">"; $umsg = getunreadpm(getuid_sid($sid)); if($umsg>0) { echo "<a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a><br/>"; } $num_pages = getnumpages($tid); if($page==""||$page<1)$page=1; if($go!="")$page=getpage_go($go,$tid); $posts_per_page = 5; if($page>$num_pages)$page=$num_pages; $limit_start = $posts_per_page *($page-1); echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid\">Post reply</a>"; $lastlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&go=last\">Last Page</a>"; $firstlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&page=1\">First Page</a> "; $golink = ""; if($page>1) { $golink = $firstlink; } if($page<$num_pages) { $golink .= $lastlink; } if($golink !="") { echo "<br/>$golink"; } $vws = $tinfo[4]+1; $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'")); echo "<br/>Replies: $rpls[0] - Views: $vws<br/>"; echo "</div>"; echo "<div>"; echo "<br/>"; ///fm here if($page==1) { $posts_per_page=4; mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE id='".$tid."'"); $ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'")); $unick = getnick_uid($ttext[0]); if(isonline($ttext[0])) { $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>"; }else{ $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>"; } $for = "<br/>".forat($ttext[0]).""; $usl = "<br/>Topic Author: <a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$iml$unick</a>$for"; $topt = "<a href=\"index.php?action=tpcopt&sid=$sid&tid=$tid\">*</a>"; if($go==$tid) { $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>"; }else{ $fli =""; } $pst = parsemsg($ttext[1],$sid); echo "» $fli$pst $topt$usl<br/>"; $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$ttext[0]."'")); $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$ttext[0]."'")); $plink = "<a href=\"lists.php?action=uposts&sid=$sid&who=$ttext[0]\">$unol[0]</a>"; echo "Forum Post $plink/$unop[0]<br/>"; $dtot = date("d-m-y - H:i:s",$ttext[2]); echo $dtot; echo "<br/>"; echo "<hr width=\"100%\"/>"; if($ttext[3]>0) { echo "<a href=\"index.php?action=viewtpl&sid=$sid&who=$tid\">POLL</a><br/>"; } } if($page>1) { $limit_start--; } $sql = "SELECT id, text, uid, dtpost, quote FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page"; $posts = mysql_query($sql); while($post = mysql_fetch_array($posts)) { $unick = getnick_uid($post[2]); if(isonline($post[2])) { $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>"; }else{ $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>"; } $que = mysql_fetch_array(mysql_query("SELECT text, uid, dtpost FROM ibwf_posts WHERE id='".$post[4]."'")); $nick = getnick_uid($que[1]); $dto = date("d-m-y - H:i:s",$que[2]); $as = parsemsg($que[0], $sid); $quo = "<i>[$nick Wrote:$as<br/>$dto]</i><br/>"; $for = "<br/>".forat($post[2]).""; $usl = "<br/>Post BY: <a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\">$iml$unick</a>$for"; $pst = parsemsg($post[1], $sid); $topt = "<a href=\"index.php?action=pstopt&sid=$sid&pid=$post[0]&page=$page&fid=$tinfo[5]\">*</a>"; if($post[4]>0) { $qtl = "<small><i><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>"; } if($go==$post[0]) { $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>"; }else{ $fli =""; } if($post[4]==0) { echo "» $fli$pst $topt$usl<br/>"; }else{ echo "» $quo » $fli$pst $topt$usl<br/>"; } $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$post[2]."'")); $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$post[2]."'")); $plink = "<a href=\"lists.php?action=uposts&sid=$sid&who=$post[2]\">$unol[0]</a>"; echo "Forum Post $plink/$unop[0]<br/>"; $dtot = date("d-m-y - H:i:s",$post[3]); echo $dtot; echo "<br/>"; echo "<hr width=\"100%\"/>"; } ///to here echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"index.php?action=viewtpc&page=$ppage&sid=$sid&tid=$tid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"index.php?action=viewtpc&page=$npage&sid=$sid&tid=$tid\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets = "<form action=\"index.php\" method=\"get\">"; $rets .= "Jump<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"Submit\" value=\"Go\" Name=\"Submit\"/></form>"; echo $rets; } echo "</div>"; echo "<div align=\"center\">"; echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid\">Post reply</a><br/>"; $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Topic'")); echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>"; $fid = $tinfo[5]; $fname = getfname($fid); $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'")); $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'")); $cname = $cinfo[0]; $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'")); $fname = htmlspecialchars($fname); echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">Back To $fname</a><br/>"; if($cid[0]>0) { $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'")); $cname = htmlspecialchars($cinfo[0]); echo "<a href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>"; echo forumlink($sid); }else{ $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 "<a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>"; } echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>"; echo "</div>"; echo "</body>"; exit(); } //////////////////////////////////View Forum else if($action=="viewfrm") { $fid = cleanQuery($_GET["fid"]); $view = cleanQuery($_GET["view"]); if(!canaccess(getuid_sid($sid), $fid)) { addonline(getuid_sid($sid),"im viewing admin forum naughty me",""); echo "<head>"; $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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),"Viewing Forum","index.php?action=viewfrm&sid=$sid&fid=$fid"); $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'")); $fnm = htmlspecialchars($finfo[0]); $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); echo "<body>"; echo "<p align=\"center\">"; $umsg = getunreadpm(getuid_sid($sid)); if($umsg>0) { echo "<br/><a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a><br/>"; } $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'")); if($norf[0]>0) { echo "<a href=\"rwrss.php?action=showfrss&sid=$sid&fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>"; } echo "<a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>"; echo "<form action=\"index.php\" method=\"get\">"; echo "View: <select name=\"view\">"; echo "<option value=\"all\">All</option>"; echo "<option value=\"new\">Since Last Visit</option>"; echo "<option value=\"myps\">I posted In</option>"; echo "</select>"; echo "<input type=\"submit\" value=\"Go\"/>"; echo "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>"; echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; echo "</form>"; echo "<br/>"; if($view=="new") { echo "<small>Viewing topics that has no new posts since your last visit</small>"; }else if($view=="myps") { echo "<small>Viewing topics contain posts by you</small>"; }else { echo "<small>Viewing All topics</small>"; } echo "</p>"; echo "<p>"; if($page=="" || $page<=0)$page=1; if($page==1) { ///////////pinned topics $topics = mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5"); while($topic = mysql_fetch_array($topics)) { $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, authorid 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, a.authorid 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, authorid 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)"; } $who = $topic[6]; $user = getnick_uid($who); $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>"; $tnm = htmlspecialchars($topic[1]); echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$iml$tnm$atxt</a><br/> <i>Total Post: $nop[0]</i><br/>Author: <i>$vulnk</i><br/><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/><a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>"; $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum'")); echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/>"; $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'")); if($cid[0]>0) { $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'")); $cname = htmlspecialchars($cinfo[0]); echo "<a href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>"; echo forumlink($sid); }else{ $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 "<br/><a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>"; echo forumlink($sid); } echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>"; echo "</p>"; echo "</body>"; exit(); } ////////////////////////////////////////////////NEW TOPIC else if($action=="newtopic") { $fid = $_GET["fid"]; if(!canaccess(getuid_sid($sid), $fid)) { $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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 xhtmlfoot(); exit(); } addonline(getuid_sid($sid),"Creating new topic - xHTML","index.php?action=online"); $pstyle = gettheme($sid); echo xhtmlhead("New Topic",$pstyle); echo "<p align=\"center\">"; echo "<form method=\"post\" action=\"genproc.php?action=newtopic&sid=$sid\">"; echo "Title:<input name=\"ntitle\" maxlength=\"30\"/><br/>"; echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/><br/>"; echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>"; echo "<input type=\"submit\" name=\"Submit\" value=\"Create\"/><br/>"; echo "</form>"; echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">"; $fname = getfname($fid); echo "$fname</a><br/>"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); exit(); } //////////////////////////////////////////////Post reply else if($action=="post") { $tid = $_GET["tid"]; $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'")); $fid = $tfid[0]; if(!canaccess(getuid_sid($sid), $fid)) { $pstyle = gettheme($sid); echo xhtmlhead("$stitle",$pstyle); 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 xhtmlfoot(); exit(); } addonline(getuid_sid($sid),"Posting reply - xHTML",""); $pstyle = gettheme($sid); echo xhtmlhead("Post Reply",$pstyle); echo "<onevent type=\"onenterforward\">"; echo "<refresh> <setvar name=\"reptxt\" value=\"\"/> <setvar name=\"qut\" value=\"\"/> "; echo "</refresh></onevent>"; $qut = $_GET["qut"]; echo "<p align=\"center\">"; echo "<form method=\"post\" action=\"genproc.php?action=post&sid=$sid\">"; echo "Text:<input name=\"reptxt\" maxlength=\"500\"/><br/>"; echo "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>"; echo "<input type=\"hidden\" name=\"qut\" value=\"$qut\"/>"; echo "<input type=\"submit\" name=\"Submit\" value=\"Reply\"/><br/>"; echo "</form>"; $fid = getfid($tid); $fname = getfname($fid); echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">"; echo "Back to topic</a>"; echo "<br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">"; echo "$fname</a><br/>"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); exit(); } ///////////////////////////////////////////// else if($action=="tpcopt") { $tid = $_GET["tid"]; addonline(getuid_sid($sid),"Topic Options - xHTML",""); $tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed FROM ibwf_topics WHERE id='".$tid."'")); $trid = $tinfo[2]; $ttext = htmlspecialchars($tinfo[3]); $tname = htmlspecialchars($tinfo[0]); $pstyle = gettheme($sid); echo xhtmlhead("Topic Options",$pstyle); echo "<onevent type=\"onenterforward\">"; echo "<refresh> <setvar name=\"ttext\" value=\"$ttext\"/> <setvar name=\"tname\" value=\"$tname\"/>"; echo "</refresh></onevent>"; echo "<p align=\"center\">"; echo "<b>Topic Options</b>"; echo "</p>"; echo "<p>"; echo "Topic ID: <b>$tid</b><br/>"; $trnick = getnick_uid($trid); echo "<a href=\"inbox.php?action=sendpm&sid=$sid&who=$trid\">»Send PM to $trnick</a><br/>"; echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$trid\">»View $trnick's Profile</a><br/>"; //echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid&qut=$pid\">»Quote</a><br/>"; $plid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'")); if($plid[0]==0) { if(ismod($uid)) { echo "<a href=\"index.php?action=pltpc&sid=$sid&tid=$tid\">»Add Poll</a><br/>"; } }else{ if(ismod($uid)) { echo "<a href=\"genproc.php?action=dltpl&sid=$sid&tid=$tid\">»Delete Poll</a><br/>"; } } echo "<a href=\"genproc.php?action=rtpc&sid=$sid&tid=$tid\">»Report</a><br/>"; echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&page=1\">«Back to topic</a><br/>"; if(ismod(getuid_sid($sid))) { echo "<form method=\"post\" action=\"mprocpl.php?action=rentpc&sid=$sid&tid=$tid\">"; echo "<br/>Title: <input name=\"tname\" value=\"$tname\" maxlength=\"25\"/>"; echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Rename\"/><br/>"; echo "</form>"; echo "<form method=\"post\" action=\"mprocpl.php?action=edttpc&sid=$sid&tid=$tid\">"; echo "<br/>Text: <input name=\"ttext\" value=\"$ttext\" maxlength=\"500\"/> "; echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>"; echo "</form>"; echo "<a href=\"mprocpl.php?action=delt&sid=$sid&tid=$tid\">»DELETE</a><br/>"; echo "<br/>"; if($tinfo[5]=='1') { $ctxt = "Open"; $cact = "0"; }else{ $ctxt = "Close"; $cact = "1"; } echo "<a href=\"mprocpl.php?action=clot&sid=$sid&tid=$tid&tdo=$cact\">»$ctxt</a><br/>"; if($tinfo[4]=='1') { $ptxt = "Unpin"; $pact = "0"; }else{ $ptxt = "Pin"; $pact = "1"; } echo "<a href=\"mprocpl.php?action=pint&sid=$sid&tid=$tid&tdo=$pact\">»$ptxt</a><br/>"; //echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid&qut=$pid\">»Quote</a><br/>"; echo "<br/>Move to:<br/>"; echo "<form method=\"post\" action=\"mprocpl.php?action=mvt&sid=$sid&tid=$tid\">"; $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE clubid='0'"); echo "<select name=\"mtf\">"; while ($forum = mysql_fetch_array($forums)) { echo "<option value=\"$forum[0]\">$forum[1]</option>"; } echo "</select><br/>"; echo "<input type=\"submit\" name=\"Submit\" value=\"Move\"/><br/>"; echo "</form>"; } echo "</p>"; echo "<p align=\"center\">"; $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'")); $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'")); echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo "</p>"; echo xhtmlfoot(); exit(); } /////////////////////////////////// if($action=="forumindx") { addonline(getuid_sid($sid),"Forum Index","index.php?action=$action"); $sid = cleanQuery($_GET["sid"]); $uid = getuid_sid($sid); $pstyle = gettheme($sid); echo xhtmlhead("Forum Menu",$pstyle); echo "<body>"; echo "<div><b><i>Forum Index</i></b></div>"; echo "<div>"; echo "<a href=\"search.php?action=tpc&sid=$sid\">[Search]</a><br/>"; if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_fcats")); $num_items = $noi[0]; $items_per_page= 5; $num_pages = ceil($num_items/$items_per_page); if(($page>$num_pages)&&$page!=1)$page= $num_pages; $limit_start = ($page-1)*$items_per_page; $sql = "SELECT id, name, descrip FROM ibwf_fcats ORDER BY position, id DESC LIMIT $limit_start, $items_per_page"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $catlink = "<a href=\"index.php?action=viewcat&sid=$sid&cid=$item[0]\">[ $item[1] ]</a>"; echo "<br/><br/>$catlink<br/><i>$item[2]</i><br/>Moderated By: "; $mod = "SELECT DISTINCT name FROM ibwf_modr WHERE forum='".$item[0]."' ORDER BY name"; $itm = mysql_query($mod); echo mysql_error(); if(mysql_num_rows($itm)>0) { while ($it = mysql_fetch_array($itm)) { $who = $it[0]; $user = getnick_uid($who); $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>"; echo "<i>$vulnk,</i>"; }} } } echo "<br/>"; echo "</div>"; echo "<div>"; if($page>1) { $ppage = $page-1; echo "<a href=\"index.php?action=forumindx&page=$ppage&sid=$sid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"index.php?action=forumindx&page=$npage&sid=$sid\">Next»</a>"; } echo "<br/>$page of $num_pages<br/>"; echo "</div>"; echo "<div>"; $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Forum Index'")); echo "<i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">©$stitle</a>"; echo "</p></div>"; echo "</body>"; }
Comment