startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['credits'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); print "

Forums


"; if($ir['forumban']) { die("

! ERROR

You have been forum banned for {$ir['forumban']} days.

Reason: {$ir['fb_reason']}
"); } $_GET['viewforum']=(int) $_GET['viewforum']; if($_GET['viewtopic'] and $_GET['act'] != 'quote') { $_GET['act']='viewtopic'; } if($_GET['viewforum']) { $_GET['act']='viewforum'; } if($_GET['reply']) { $_GET['act']='reply'; } if($_GET['empty']==1 && $_GET['code']=='kill' && $_SESSION['owner']) { emptyallforums(); } function forum() { $_GET['topic'] = abs((int) $_GET['topic']); $_GET['reply'] = abs((int) $_GET['reply']); $_GET['t'] = abs((int) $_GET['t']); global $ir,$c,$userid,$data; if($_GET['topic']) { $_GET['act2']="viewtopic"; $_GET['t']=$_GET['topic']; } if($_GET['reply']) { $_GET['act2']="reply"; $_GET['t']=$_GET['reply']; } switch($_GET['act2']) { case "forum": forum(); break; case 'viewforum': viewforum(); break; case 'viewtopic': viewtopic(); break; case "reply": forums_reply(); break; case "newtopicform": forums_newt_form(); break; case "newtopicsub": forums_newt_sub(); break; default: forums_idx(); break; } } function forums_idx() { global $ir, $c, $userid, $h, $bbc; $q=mysql_query("SELECT * FROM forum_forums WHERE ff_auth='public' ORDER BY ff_id ASC", $c) or die(mysql_error()); print "\n"; while($r=mysql_fetch_array($q)) { $t=date('F j Y, g:i:s a',$r['ff_lp_time']); print "\n"; } print "\n
Forum Posts Topics Last Post
{$r['ff_name']}
{$r['ff_desc']}
{$r['ff_posts']} {$r['ff_topics']} $t
In: {$r['ff_lp_t_name']}
By: {$r['ff_lp_poster_name']}
"; if($ir['user_level'] <> 1) { print "

Staff-Only Forums


"; $q=mysql_query("SELECT * FROM forum_forums WHERE ff_auth='staff' ORDER BY ff_id ASC", $c) or die(mysql_error()); print "\n"; while($r=mysql_fetch_array($q)) { $t=date('F j Y, g:i:s a',$r['ff_lp_time']); print "\n"; } print "\n
Forum Posts Topics Last Post
{$r['ff_name']}
{$r['ff_desc']}
{$r['ff_posts']} {$r['ff_topics']} $t
In: {$r['ff_lp_t_name']}
By: {$r['ff_lp_poster_name']}
"; } $stats=cache_get('forumstats',$c); print "

Forum Stats (Updated Hourly)
{$stats['membs']} MC players have posted at least 1 of the {$stats['posts']} posts in {$stats['topics']} topics."; } print ""; } function viewforum() { global $ir, $c, $userid, $h, $bbc; $q=mysql_query("SELECT * FROM forum_forums WHERE ff_id={$_GET['viewforum']}", $c); $r=mysql_fetch_array($q); if($r['ff_auth']=='gang' OR ($r['ff_auth'] == 'staff' AND $ir['user_level'] < 2)) { print "You have no permission to view this forum.
> Back"; $h->endpage(); exit; } if($_GET['viewforum'] <> 1 OR $ir['user_level']==2) { $ntl=" [New Topic]"; } else { $ntl=""; } print "Forums Home >> {$r['ff_name']}$ntl

\n"; $q=mysql_query("SELECT * FROM forum_topics WHERE ft_forum_id={$_GET['viewforum']} ORDER BY ft_pinned DESC, ft_last_time DESC", $c) or die(mysql_error()); while($r2=mysql_fetch_array($q)) { $t1=date('F j Y, g:i:s a',$r2['ft_start_time']); $t2=date('F j Y, g:i:s a',$r2['ft_last_time']); if($r2['ft_pinned']) { $pt="Pinned: "; } else { $pt=""; } if($r2['ft_locked']) { $lt=" (Locked)"; } else { $lt=""; } print "\n"; } print "
Topic Posts Started Last Post
$pt{$r2['ft_name']}$lt
{$r2['ft_desc']}
{$r2['ft_posts']} $t1
By: {$r2['ft_owner_name']}
$t2
By: {$r2['ft_last_name']}
"; } function forums_viewtopic() { global $ir,$c,$userid,$data; $tpcd=mysql_query("SELECT t.*,u1.* FROM forums_topics t LEFT JOIN users u1 ON t.ft_userid=u1.userid WHERE t.ft_id={$_GET['t']}",$c); mysql_query("UPDATE forums_topics SET ft_views=ft_views+1 WHERE ft_id={$_GET['t']}",$c); $topic=mysql_fetch_array($tpcd); $posts[0]['username']=$topic['username']; $posts[0]['userid']=$topic['userid']; $posts[0]['time']=$topic['ft_starttime']; $posts[0]['level']=$topic['level']; $posts[0]['nr']=1; $posts[0]['text']=str_replace("\n","
",$topic['ft_text']); $cntr=0; $pq=mysql_query("SELECT r.*,u.* FROM forums_replies r LEFT JOIN users u ON r.fr_userid=u.userid WHERE r.fr_topic={$_GET['t']} ORDER BY fr_posttime ASC;",$c); while($r=mysql_fetch_array($pq)) { $cntr++; $posts[$cntr]['username']=$r['username']; $posts[$cntr]['userid']=$r['userid']; $posts[$cntr]['time']=$r['fr_posttime']; $posts[$cntr]['level']=$r['level']; $posts[$cntr]['nr']=$cntr+1; $posts[$cntr]['text']=str_replace("\n","
",$r['fr_text']); } print ""; foreach($posts as $cpost) { print ""; } print "
{$topic['ft_title']}
Post #{$cpost['nr']}Time Posted: ".date('F j Y, g:i:s a',$cpost['time'])."
{$cpost['username']}
Level: {$cpost['level']}
{$cpost['text']}
"; print "
"; print "
Add Reply
Your Post: (no HTML, linebreaks automatically converted to <br />)

"; } function forums_reply() { global $ir,$c,$userid,$data; $t=$_GET['t']; $post=str_replace(array("<",">","'"),array("<",">","''"),$_POST['textpost']); mysql_query("INSERT INTO forums_replies VALUES('',$userid,{$data['ID']},$t,'$post',unix_timestamp())",$c); mysql_query("UPDATE forums_topics SET ft_replies=ft_replies+1,ft_lastpost=unix_timestamp(),ft_lastposterid=$userid WHERE ft_id=$t",$c); print "
News
Reply Posted!

"; forums_viewtopic(); } function forums_newt_form() { global $ir,$c,$userid,$data; print "Creating New Topic....
Title:
Your Topic:
(no HTML, linebreaks automatically converted to <br />)
"; } function forums_newt_sub() { global $ir,$c,$userid,$data; $title=str_replace(array("<",">","'"),array("<",">","''"),$_POST['topictitle']); $post=str_replace(array("<",">","'"),array("<",">","''"),$_POST['topictext']); mysql_query("INSERT INTO forums_topics VALUES('',$userid,{$data['ID']},'$title','$post',0,0,unix_timestamp(),$userid, unix_timestamp())",$c); $iq=mysql_query("SELECT max(ft_id) AS tid FROM forums_topics",$c); $iee=mysql_fetch_array($iq); print "
News
Topic Posted!

"; $_GET['t']=$iee['tid']; forums_viewtopic(); } $h->endpage(); ?>