posible forum
u coud make forum from this one
forum.php
PHP Code:
<?php (!defined('IN_SCRIPT') ? exit(0) : null); ?> <script language="javascript1.2"> var form_id; function confirm_delete(go_url) { var answer = confirm("Are you sure to delete this post?"); if (answer) { location=go_url; } } </script> <script language="javascript" type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "simple" }); </script> <?php /** Get the forum settings **/ $settings = mysql_query("SELECT * FROM settings_forums"); $settings = @mysql_fetch_array($settings); /** Set the variables from the admin **/ $guest_posting = $settings['guest_posting']; $posts_per_page = $settings['posts_per_page']; /** Kill the board is the admin has deactivated **/ if($settings['forum_active']==0) { echo "<p class='message'>".ERROR_FORUM_OFF.".</p>"; }else{ /** Set the global mode **/ $mode = clean($_GET['mode']); /** No action or mode present who categorys **/ if(!$mode && !$_GET['a'] && !$_GET['type']) { /** Get all the main forums **/ $result = mysql_query("SELECT * FROM forum_cat WHERE forum_active = '1' ORDER BY forum_order ASC") or die (mysql_error()); $total = @mysql_num_rows($result); /** If there is no forums **/ if($total==0) { echo "<p class='message'>".ERROR_NO_TYPE.".</p>"; }else{ $i=0; /** Show the forums **/ ?> <table class="forum_home_top" cellspacing="0"> <tr> <td class="forumhomebox">Forum</td> <td class="forumhomebox">Topics</td> <td class="forumhomebox">Posts</td> <td class="forumhomebox">Last Post</td> </tr> <?php /** Loop the results **/ while($i<$total) { $forum_id = mysql_result($result, $i, 'forum_id'); $forum_title = mysql_result($result, $i, 'forum_title'); $forum_password = mysql_result($result, $i, 'forum_password'); $forum_active = mysql_result($result, $i, 'forum_active'); $forum_desc = mysql_result($result, $i, 'forum_desc'); /** Total topics **/ $topics = mysql_query("SELECT * FROM forum_topics WHERE forum_id = '$forum_id'") or die (mysql_error()); $topics = @mysql_num_rows($topics); /** Total posts **/ $posts = mysql_query("SELECT * FROM forum_posts WHERE forum_id = '$forum_id'") or die (mysql_error()); $posts = @mysql_num_rows($posts); /** Get the last post **/ $lastpost = mysql_query("SELECT * FROM forum_posts WHERE forum_id = '$forum_id' ORDER BY post_posted DESC") or die (mysql_error()); $lastpost = @mysql_fetch_array($lastpost); /** Get the last post information **/ if($lastpost) { $post_id = $lastpost['post_id']; $topic_id = $lastpost['topic_id']; $post_poster = $lastpost['post_poster']; $post_posted = $lastpost['post_posted']; /** Get the topics title **/ $topic_title = mysql_query("SELECT * FROM forum_topics WHERE topic_id = '$topic_id'") or die (mysql_error()); $topic_title = @mysql_fetch_array($topic_title); $topic_title = $topic_title['topic_title']; /** Get the last posters information **/ $member = mysql_query("SELECT * FROM members WHERE id = '$post_poster'") or die (mysql_error()); $member = @mysql_fetch_array($member); $member_username = $member['username']; $country = $member['country']; /** Set the posttime and date in readable format **/ $posttime = date("H:i D d M", $post_posted); /** Set guest if its not there **/ if(!$member_username) { $member_username = "Guest"; } /** Trim the title **/ if(strlen($topic_title) > 15) { $topic_title = substr($topic_title, 0, 15).".."; } /** No guest means set link to profile **/ if($member_username!="Guest") { $lastposter = "<a href='index.php?page=members&id=$post_poster'>$member_username</a><br /><a href='index.php?page=forum&mode=viewtopic&t=$topic_id#post$post_id'>$topic_title</a><br />$posttime"; /** Make topic link for a guest **/ }else{ $lastposter = "Guest<br /><a href='index.php?page=forum&mode=viewtopic&t=$topic_id#post$post_id'>$topic_title</a><br />$posttime"; } /** Set never if there was not a topic **/ }else{ $lastpost = "Never"; } /** Set alt for colours **/ if($i%2) { $alt=1; }else{ $alt=2; } /** Check the forum has not been deactivated **/ if($forum_active!=0) { /** Output the results **/ ?> <tr class="forumdisplay<?php echo $alt; ?>"> <td class="forumhomebox1" valign="top"><a href="index.php?page=forum&mode=viewforum&f=<?php echo $forum_id; ?>"><?php echo $forum_title; ?></a> <?php if($forum_password) { echo " Protected "; } ?><br /><?php echo $forum_desc; ?></td> <td class="forumhomebox1"><?php echo $topics; ?></td> <td class="forumhomebox1"><?php echo $posts; ?></td> <td class="forumhomebox1"><?php if($lastpost!="Never") { echo flags($country)." ".$lastposter; }else{ echo $lastpost; } ?></td> </tr> <?php } $i++; /** End loop **/ } /** End table **/ echo "</table>"; } } /** End forum display **/ /** Start topic displaying **/ if($_GET['a']=="posttopic" && !$_GET['type']) { /** Set the form id **/ $forum_id = clean($_GET['f']); /** Error check **/ if(!$forum_id || !is_numeric($forum_id)) { echo "<p class='message'>".ERROR_NO_TYPE.".</p>"; }else{ /** Get the forum information **/ $result1 = mysql_query("SELECT * FROM forum_cat WHERE forum_id = '$forum_id'") or die (mysql_error()); $protection = @mysql_fetch_array($result1); /** Set the forum information **/ $forum_desc = $protection['forum_desc']; $forum_title = $protection['forum_title']; /** Check if the admin has set a pass on the forum **/ if($protection['forum_password'] && !$_SESSION[$prefix.'forum_login'.$forum_id]) { /** If post login **/ if($_POST['login_forum']) { $postedpass = clean($_POST['forum_login']); $f = clean($_POST['forum_id']); /** Error check **/ if(!$postedpass || empty($postedpass)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Check the password for a match **/ if($postedpass == $protection['forum_password']) { /** Register a session if all ok **/ $_SESSION[$prefix.'forum_login'.$forum_id] = 1; header("Location:index.php?page=forum&a=posttopic&f=$f"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&a=posttopic&f=$f'>"; }else{ echo "<p class='message'>".ERROR_WRONG_PASS.".</p>"; } } } /** End checks **/ /** Show the form **/ if(!$_POST['login_forum']) { echo '<p class="message">'.ERROR_FORUM_PROTECTED.'.</p>'; } /** Show the form **/ ?> <form action="" name="forum_login" method="post"> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>"/> <table width="350" border="0" style="margin:0px auto;"> <tr> <td><?php echo STND_PASSWORD; ?></td> <td><input type="password" name="forum_login" class="standardforms"/></td> </tr> <tr> <td> </td> <td><input type="submit" name="login_forum" value="<?php echo STND_ENTER_FORUM; ?>" class="standardforms"/></td> </tr> </table> </form> <?php }else{ /** Show the error **/ if($settings['guest_posting']==0 && !$_SESSION[$prefix.'logged_user']) { /** Send them to the login form **/ $_SESSION['error'] = ERROR_LOGGED_IN; header("Location:index.php?page=login"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=login'>"; }else{ /** Show menu **/ ?> <div class="descriptionforum"><a href="index.php?page=forum">Forum Home</a> / <a href="index.php?page=forum&a=posttopic&f=<?php echo $f; ?>">Post New Topic</a></div> <?php /** Post add **/ if($_POST['add_topic']) { $topic_title = clean($_POST['topic_title']); $post = clean_html($_POST['post']); $forum_id = clean($_POST['forum_id']); $topic_posted = time(); $topic_views = 0; $posters_ip = $_SERVER['REMOTE_ADDR']; /** Guest name **/ if(!$_SESSION[$prefix.'logged_user']) { $topic_poster = ""; }else{ /** Update members post count **/ $topic_poster = $_SESSION[$prefix.'user_id']; $theuser = mysql_query("SELECT * FROM members WHERE id = '$topic_poster'"); $theuser = @mysql_fetch_array($theuser); $total_postse = $theuser['posts']+1; mysql_query("UPDATE members SET posts = '$total_postse' WHERE id = '$topic_poster'"); } /** Error check **/ if(!$topic_title || !$post) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Final id **/ $finalid = mysql_query("SELECT * FROM forum_topics ORDER BY topic_id DESC"); $finalid = @mysql_fetch_array($finalid); $finalid = $finalid['topic_id']+1; /** Add the new entry **/ mysql_query("INSERT INTO forum_posts (forum_id, topic_id, post, post_poster, post_posted, posters_ip) VALUES ('$forum_id', '$finalid', '$post', '$topic_poster', '$topic_posted', '$posters_ip')") or die (mysql_error()); mysql_query("INSERT INTO forum_topics (topic_title, forum_id, topic_poster, topic_posted, topic_views) VALUES ('$topic_title', '$forum_id', '$topic_poster', '$topic_posted', '$topic_views')") or die (mysql_error()); header("Location:index.php?page=forum&mode=viewtopic&t=$finalid"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewtopic&t=$finalid'>"; } } ?> <form action="" name="new_topic" method="post"> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" /> <table class="posttopic"> <tr> <td><?php echo STND_TOPIC_TITLE; ?></td> <td> <input name="topic_title" type="text" size="35" class="standardforms"/> </td> </tr> <tr> <td>Options</td> <td> </td> </tr> <tr> <td valign="top">Post</td> <td> <textarea name="post" cols="30%" rows="5"></textarea> </td> </tr> <tr> <td> </td> <td> <input type="submit" name="add_topic" value="<?php echo STND_POST_TOPIC; ?>" class="standardforms"/> </td> </tr> </table> </form> <?php } } } } /** End view topics **/ /** Get the view forum **/ if($mode=="viewforum" && !$_GET['a'] && !$_GET['type']) { $f = clean($_GET['f']); /** Set the default page **/ if (isset($_GET['pageno'])) { $pageno = clean($_GET['pageno']); }else{ $pageno = 1; } /** Error check **/ if(!$f || !is_numeric($f)) { echo "<p class='message'>".ERROR."</p>"; }else{ /** Get the forum **/ $result = mysql_query("SELECT * FROM forum_topics WHERE forum_id = '$f'") or die (mysql_error()); $total = @mysql_num_rows($result); /** Set total to show per page **/ $rows_per_page = 10; /** Round the number up **/ $lastpage = ceil($total/$rows_per_page); /** Work out current page **/ $pageno = (int)$pageno; if ($pageno<1) { $pageno = 1; }elseif ($pageno > $lastpage) { $pageno = $lastpage; } if($row_per_page > $total) { /** Create the limit query **/ $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; } /** Get the forums information **/ $result = mysql_query("SELECT * FROM forum_topics WHERE forum_id = '$f' ORDER BY topic_posted DESC $limit") or die (mysql_error()); $result1 = mysql_query("SELECT * FROM forum_cat WHERE forum_id = '$f'") or die (mysql_error()); $protection = @mysql_fetch_array($result1); $forum_desc = $protection['forum_desc']; $forum_title = $protection['forum_title']; /** Let them in if settings says so **/ if($protection['forum_password'] && !$_SESSION[$prefix.'forum_login'.$f]) { /** Post login **/ if($_POST['login_forum']) { $postedpass = clean($_POST['forum_login']); $f = clean($_POST['forum_id']); /** Error check **/ if(!$postedpass || empty($postedpass)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** If it matches **/ if($postedpass == $protection['forum_password']) { /** Set the session **/ $_SESSION[$prefix.'forum_login'.$f] = 1; header("Location:index.php?page=forum&mode=viewforum&f=$f"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewforum&f=$f'>"; /** Error message **/ }else{ echo "<p class='message'>".ERROR_WRONG_PASS.".</p>"; } } } /** End **/ /** Show form **/ if(!$_POST['login_forum']) { echo '<p class="message">'.ERROR_FORUM_PROTECTED.'.</p>'; } ?> <form action="" name="forum_login" method="post"> <input type="hidden" name="forum_id" value="<?php echo $f; ?>"/> <table width="350" border="0" style="margin:0px auto;"> <tr> <td><?php echo STND_PASSWORD; ?></td> <td><input type="password" name="forum_login" class="standardforms"/></td> </tr> <tr> <td> </td> <td><input type="submit" name="login_forum" value="<?php echo STND_ENTER_FORUM; ?>" class="standardforms"/></td> </tr> </table> </form> <?php }else{ /** Set the total **/ $total = mysql_num_rows($result); ?> <div class="descriptionforum"><?php echo $forum_desc; ?></div> <div class="descriptionforum"><a href="index.php?page=forum">Forum Home</a> / <a href="index.php?page=forum&mode=viewforum&f=<?php echo $f; ?>"><?php echo $forum_title; ?></a> / <a href="index.php?page=forum&a=posttopic&f=<?php echo $f; ?>">Post New Topic</a></div> <?php /** Error check **/ if($total==0) { echo "<p class='message'>".ERROR_NO_TYPE.".</p>"; }else{ $i=0; ?> <table class="forum_home" cellspacing="0"> <tr> <td class="forumhomebox">Topic Title</td> <td class="forumhomebox">Replys</td> <td class="forumhomebox">Views</td> <td class="forumhomebox">Last Post</td> </tr> <?php /** Start Loop **/ while($i<$total) { $topic_title = mysql_result($result, $i, 'topic_title'); $topic_id = mysql_result($result, $i, 'topic_id'); $topic_poster = mysql_result($result, $i, 'topic_poster'); $topic_posted = mysql_result($result, $i, 'topic_posted'); $topic_views = mysql_result($result, $i, 'topic_views'); /** Get last post **/ $lastpost = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$topic_id' ORDER BY post_posted DESC") or die (mysql_error()); $replys = @mysql_num_rows($lastpost); $lastpost = @mysql_fetch_array($lastpost); /** Set last post settings **/ if($lastpost) { $post_id = $lastpost['post_id']; $topic_id = $lastpost['topic_id']; $post_poster = $lastpost['post_poster']; $post_posted = $lastpost['post_posted']; $post = $lastpost['post']; /** Tidy up the posts **/ $post = substr($post, 0, 100); /** Tidy up the titles **/ if(strlen($topic_title) > 50) { $topic_title = substr($topic_title, 0, 50)."..."; } } /** Get members details **/ $member = mysql_query("SELECT * FROM members WHERE id = '$post_poster'") or die (mysql_error()); $member = @mysql_fetch_array($member); $member_username = $member['username']; $country = $member['country']; /** Last post **/ $lastpost = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$topic_id' ORDER BY post_posted DESC") or die (mysql_error()); $lastpost = @mysql_fetch_array($lastpost); /** Last post details **/ if($lastpost) { $post_id = $lastpost['post_id']; $topic_id = $lastpost['topic_id']; $post_poster = $lastpost['post_poster']; $post_posted = $lastpost['post_posted']; /** Get topic title **/ $topic_title = mysql_query("SELECT * FROM forum_topics WHERE topic_id = '$topic_id'") or die (mysql_error()); $topic_title = @mysql_fetch_array($topic_title); $topic_title = $topic_title['topic_title']; /** Get member information **/ $member = mysql_query("SELECT * FROM members WHERE id = '$post_poster'") or die (mysql_error()); $member = @mysql_fetch_array($member); $member_username = $member['username']; $location = $member['location']; /** Make posted readable **/ $posttime = date("H:i D d M Y", $post_posted); $lastposter = "<a href='index.php?page=members&id=$post_poster'>$member_username</a><br />$posttime"; /** Set never if no posts **/ }else{ $lastpost = "Never"; } /** Set alt value **/ if($i%2) { $alt=1; }else{ $alt=2; } /** Default flag **/ if(!$flag) { $flag = "uploads/flags/unknown.gif"; } ?> <tr class="forumdisplay<?php echo $alt; ?>"> <td class="forumhomebox1"><a href="index.php?page=forum&mode=viewtopic&t=<?php echo $topic_id; ?>"><?php echo $topic_title; ?></a></td> <td class="forumhomebox1"><?php echo $replys; ?></td> <td class="forumhomebox1"><?php echo $topic_views; ?></td> <td class="forumhomebox1"><?php if($lastpost!="Never") { echo flags($country)." ".$lastposter; }else{ echo $lastpost; } ?></td> </tr> <?php $i++; } /** End loop **/ echo "</table>"; /** End table **/ /** Do nothing if page = 1 **/ $f = clean($_GET['f']); if ($pageno == 1) { echo ""; }else{ /** Create appropiate links **/ echo "<p class='message'>"; if($sortby and $sortby != "All") { echo " <p class='message'><a href='index.php?page=forum&mode=viewforum&f=$f&pageno=1'>First</a> "; $prevpage = $pageno-1; echo " <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=$prevpage'>Previous</a> </p>"; }else{ echo "<p class='message'> <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=1'>First</a> "; $prevpage = $pageno-1; echo " <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=$prevpage'>Previous</a> </p>"; } } /** Print page number **/ echo "( Page $pageno of $lastpage )"; /** Make links **/ if ($pageno == $lastpage) { echo ""; }else{ if($sortby and $sortby != "All") { $nextpage = $pageno+1; echo "<p class='message'> <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=$nextpage'>Next</a> "; echo " <a href='iindex.php?page=forum&mode=viewforum&f=$f&pageno=$lastpage'>Last</a> </p>"; }else{ $nextpage = $pageno+1; echo "<p class='message'> <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=$nextpage'>Next</a> "; echo " <a href='index.php?page=forum&mode=viewforum&f=$f&pageno=$lastpage'>Last</a> </p>"; } } echo "</p>"; /** End pagination **/ } } } } /** End forum **/ /** Start posts display **/ if($mode=="viewtopic" && !$_GET['a'] && !$_GET['type']) { $t=clean($_GET['t']); /** Error check **/ if(!$t || !is_numeric($t)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Start Pagination **/ if (isset($_GET['pageno'])) { $pageno = clean($_GET['pageno']); }else{ $pageno = 1; } /** Get the total **/ $result = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$t'") or die (mysql_error()); $total = @mysql_num_rows($result); $rows_per_page = $posts_per_page; $lastpage = ceil($total/$rows_per_page); /** Calculate last page **/ $pageno = (int)$pageno; if ($pageno < 1) { $pageno = 1; }elseif ($pageno > $lastpage) { $pageno = $lastpage; } /** Set dynamic limiter **/ $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; /** Run the query **/ $result = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$t' ORDER BY post_posted ASC $limit") or die (mysql_error()); $total = @mysql_num_rows($result); /** Topic details **/ $topicdetails = mysql_query("SELECT * FROM forum_topics WHERE topic_id = '$t'") or die (mysql_error()); $row = @mysql_fetch_array($topicdetails); $topic_title = $row['topic_title']; $forum_id = $row['forum_id']; $result1 = mysql_query("SELECT * FROM forum_cat WHERE forum_id = '$forum_id'") or die (mysql_error()); $protection = @mysql_fetch_array($result1); $forum_title = $protection['forum_title']; /** Check if forum is protected **/ if($protection['forum_password'] && !$_SESSION[$prefix.'forum_login'.$forum_id]) { /** Login **/ if($_POST['login_forum']) { $postedpass = clean($_POST['forum_login']); $forum_id = clean($_POST['forum_id']); /** Error message **/ if(!$postedpass || empty($postedpass)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Check match **/ if($postedpass == $protection['forum_password']) { $_SESSION[$prefix.'forum_login'.$forum_id] = 1; header("Location:index.php?page=forum&mode=viewforum&f=$forum_id"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewforum&f=$forum_id'>"; }else{ echo "<p class='message'>".ERROR_WRONG_PASS.".</p>"; } } } /** End check **/ if(!$_POST['login_forum']) { echo '<p class="message">'.ERROR_FORUM_PROTECTED.'.</p>'; } ?> <form action="" name="forum_login" method="post"> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>"/> <table width="350" border="0" style="margin:0px auto;"> <tr> <td><?php echo STND_PASSWORD; ?></td> <td><input type="password" name="forum_login" class="standardforms"/></td> </tr> <tr> <td> </td> <td><input type="submit" name="login_forum" value="<?php echo STND_ENTER_FORUM; ?>" class="standardforms"/></td> </tr> </table> </form> <?php }else{ $i=0; /** Update topic views **/ $total_views = mysql_query("SELECT * FROM forum_topics WHERE topic_id = '$t'") or die (mysql_error()); $total_views = @mysql_fetch_array($total_views); $total_views = $total_views['topic_views'] + 1; mysql_query("UPDATE forum_topics SET topic_views = '$total_views' WHERE topic_id = '$t'") or die (mysql_error()); ?> <div class="descriptionforum"><a href="index.php?page=forum">Forum Home</a> / <a href="index.php?page=forum&mode=viewforum&f=<?php echo $forum_id; ?>"><?php echo $forum_title; ?></a> / <a href="index.php?page=forum&mode=viewtopic&t=<?php echo $t; ?>"><?php echo $topic_title; ?></a> / <a href='#reply'>Post Reply</a></div> <?php /** Loop posts **/ while($i<$total) { $post_poster = mysql_result($result, $i, 'post_poster'); $post_posted = mysql_result($result, $i, 'post_posted'); $post = mysql_result($result, $i, 'post'); $topic_id = mysql_result($result, $i, 'topic_id'); $post_id = mysql_result($result, $i, 'post_id'); $posters_ip = mysql_result($result, $i, 'posters_ip'); /** Set members information **/ $member = mysql_query("SELECT * FROM members WHERE id = '$post_poster'") or die (mysql_error()); $member = @mysql_fetch_array($member); $member_username = $member['username']; $location = $member['location']; $avatar_link = $member['avatar_link']; $rank = $member['rank']; $joined = date("M Y",$member['joined']); $game = $member['game']; $id = $member['id']; $country = $member['country']; /** Get the total posts **/ $posts = mysql_query("SELECT * FROM forum_posts WHERE post_poster = '$id'"); $posts = @mysql_num_rows($posts); if(!$posters_ip || empty($posters_ip)) { $posters_ip = $member['ip']; } /** Set the game **/ if($game) { $thegame = mysql_query("SELECT * FROM games WHERE game_title = '$game'"); $thegame = @mysql_fetch_array($thegame); $game_icon = $thegame['game_icon']; } if($post_poster) { if(!file_exists("user/".$avatar_link)) { $avatar_link = "avatars/blank.jpg"; } $getusergroup = mysql_query("SELECT * FROM usergroups WHERE usergroup_id = '$rank'") or die (mysql_error()); $getusergroup = @mysql_fetch_array($getusergroup); /** Output the results **/ ?> <a name="post<?php echo $post_id; ?>"></a> <table class="viewpost" cellspacing="0"> <tr class="postbitinfo"> <td align="left"><a href="index.php?page=forum&mode=viewtopic&t=<?php echo $topic_id; ?>#post<?php echo $post_id; ?>">Post: #<?php echo $post_id; ?></a></td> <td align="right"><?php echo date("D d M Y H:i",$post_posted); ?></a></td> </tr> <tr> <td width="118" rowspan="2" valign="top" class="viewpostprofile"><?php echo flags($country); ?> <strong><a href="index.php?page=members&id=<?php echo $post_poster; ?>"><?php echo usernames($member_username, $rank); ?></a></strong> <?php if($getusergroup['usergroup_image']) { echo "<br /><img src='admin/".$getusergroup['usergroup_image']."' title='".$member_username."'/>"; } ?> <br /><br /> <img src="user/<?php echo $avatar_link; ?>" title="<?php echo $member_username; ?>" alt="<?php echo $member_username; ?>" class="avatarimage" width="80" height="80"/><br /><br /> From: <strong><?php echo $location; ?></strong><br /> Posts: <strong><?php echo $posts; ?></strong><br /> Joined: <strong><?php echo $joined; ?></strong><br /> <?php if($game) { echo "Team: $game <img src='admin/$game_icon' title='$game' alt='$game'/>"; } ?><br /> <img src="admin/images/icons/<?php if(!$member['msn']) { echo "msn_off.png"; }else{ echo "msn_on.png"; }?>" title="MSN" alt="MSN"/> <img src="admin/images/icons/<?php if(!$member['aol']) { echo "aim_off.png"; }else{ echo "aim_on.png"; }?>" title="AOL" alt="AOl"/> <img src="admin/images/icons/<?php if(!$member['skype']) { echo "skype_off.png"; }else{ echo "skype_on.png"; }?>" title="Skype" alt="Skype"/> </td> <td width="370" height="187" valign="top" class="viewpostpost"><?php echo $post; ?></td> </tr> <tr> <td align="right" valign="bottom" class="viewpostfoot"> <?php /** Admin links **/ if($_SESSION[$prefix.'logged_user'] && $_SESSION[$prefix.'admin_log']==1) { ?> <span style="float:left;">IP: <?php echo $posters_ip; ?></span> <span style="float:right;"><a href="#" onClick="confirm_delete('index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=delete');">Delete Post</a> / <a href="index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=edit">Edit Post</a> / <a href="index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=delete_topic">Delete Topic</a></span> <?php } /** Poster links **/ if($_SESSION[$prefix.'user_id'] == $post_poster && $_SESSION[$prefix.'admin_log']!=1) { ?> <span style="float:left;"><a href="index.php?page=forum&type=user&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=edit">Edit Post</a></span> <?php } ?> </td> </tr> </table> <?php }else{ ?> <table class="viewpost" cellspacing="0"> <tr> <td rowspan="2" valign="top" class="viewpostprofile"><strong>Guest</strong><br /><br /></td> <td valign="top" class="viewpostpost"><?php echo $post; ?></td> </tr> <tr> <td align="right" valign="bottom" class="viewpostfoot"> <?php /** Admin Links **/ if($_SESSION[$prefix.'logged_user'] && $_SESSION[$prefix.'admin_log']==1) { ?> <span style="float:left;">IP: <?php echo $posters_ip; ?></span> <span style="float:right;"><a href="#" onClick="confirm_delete('index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=delete');">Delete Post</a> / <a href="index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=edit">Edit Post</a> / <a href="index.php?page=forum&type=admin&postid=<?php echo $post_id; ?>&topic_id=<?php echo $topic_id; ?>&method=delete_topic">Delete Topic</a></span> <?php } ?></td> </tr> </table> <?php } $i++; } /** End display **/ /** Show pagination links **/ echo "<div class='paginationlinks'>"; if ($pageno == 1) { echo ""; }else{ /** Make links **/ if($sortby and $sortby != "All") { echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=1'>First</a> "; $prevpage = $pageno-1; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$prevpage'>Previous</a> "; }else{ echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=1'>First</a> "; $prevpage = $pageno-1; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$prevpage'>Previous</a> "; } } /** Show pages totals **/ echo " ( Page $pageno of $lastpage ) "; /** Skip **/ if ($pageno == $lastpage) { echo ""; }else{ /** Print alt links **/ if($sortby and $sortby != "All") { $nextpage = $pageno+1; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$nextpage'>Next</a> "; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$lastpage'>Last</a> "; }else{ $nextpage = $pageno+1; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$nextpage'>Next</a> "; echo " <a href='index.php?page=forum&mode=viewtopic&t=$t&pageno=$lastpage'>Last</a> "; } } echo "</div>"; /** Post button **/ if($_POST['button']) { /** Check for guest posting **/ if($settings['guest_posting']==0 && !$_SESSION[$prefix.'logged_user']) { $_SESSION['error'] = ERROR_ADMIN_PROTECT; header("Location:index.php?page=login"); echo "<meta http-equiv='refresh' content='0; url=index.php?page=login'>"; }else{ /** Set values **/ $post = clean_html($_POST['post']); $post = wordwrap($post,45,"<br />"); $topic_id = ($_POST['topic_id']); $forum_id = ($_POST['forum_id']); $post_posted = time(); $member_id = $_SESSION[$prefix.'user_id']; $posters_ip = $_SERVER['REMOTE_ADDR']; /** Error check **/ if(!$post || !$topic_id || !is_numeric($topic_id) || !is_numeric($forum_id) || !$forum_id) { echo "<script type='text/javascript'>alert('".ERROR_EMPTY."');</script>"; header("Location:index.php?page=forum&mode=viewtopic&t=$topic_id#reply"); //echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewtopic&t=$topic_id#reply'>"; }else{ /** Insert new post **/ mysql_query("INSERT INTO forum_posts (forum_id, topic_id, post_poster, post_posted, post, posters_ip) VALUES ('$forum_id', '$topic_id', '$member_id', '$post_posted', '$post', '$posters_ip')") or die (mysql_error()); if($_GET['pageno']) { $pageno = $_GET['pageno']; header("Location:index.php?page=forum&mode=viewtopic&t=$topic_id&pageno=$pageno"); /** echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewtopic&t=$topic_id&pageno=$pageno'>"; **/ }else{ header("Location:index.php?page=forum&mode=viewtopic&t=$topic_id"); /** echo "<meta http-equiv='refresh' content='0; url=index.php?page=forum&mode=viewtopic&t=$topic_id'>"; **/ } } } } /** Show form **/ ?> <p class="message"><a name="reply">Post reply</a></p> <form action="" name="forum_reply" method="post"> <input type="hidden" name="topic_id" value="<?php echo $t; ?>" /> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" /> <input type="hidden" name="pageno" value="<?php echo $_GET['pageno']; ?>" /> <table class="postreply"> <tr> <td><?php echo STND_LOGGED_IN; ?>: <?php if(!$_SESSION[$prefix.'logged_user']) { echo "Guest"; }else{ echo $_SESSION[$prefix.'logged_user']; }?></td> <td> </td> </tr> <tr> <td colspan="2"> <div align="center"> <textarea name="post" cols="35" rows="5"></textarea> </div></td> </tr> <tr> <td> <input type="submit" name="button" value="<?php echo STND_POST_REPLY; ?>" class="standardforms"> </td> <td> </td> </tr> </table> </form> <?php } } } } /** End **/ /** Start User edit post **/ if(!$_GET['mode'] && $_GET['type']=="user") { /** Deny non logged in people **/ if(!$_SESSION[$prefix.'logged_user']) { $ip = $_SERVER['REMOTE_ADDR']; echo "<p class='message'>This hacking attempt has been logged with your IP address of $ip, also the main admin has been notified of this.<p>"; }else{ /** Set the values **/ $topic_id = clean($_GET['topic_id']); $post_id = clean($_GET['postid']); $method = clean($_GET['method']); /** Check the editor is the logged in user **/ $checkuser = mysql_query("SELECT * FROM forum_posts WHERE post_id = '$post_id'") or die (mysql_error()); $checkuser = @mysql_fetch_array($checkuser); $post_poster = $checkuser['post_poster']; if($_SESSION[$prefix.'user_id'] != $post_poster) { $ip = $_SERVER['REMOTE_ADDR']; echo "<p class='message'>This hacking attempt has been logged with your IP address of $ip, also the main admin has been notified of this.<p>"; }else{ /** Error check **/ if(!$topic_id || !is_numeric($topic_id) || !$post_id || !is_numeric($post_id)) { exit(0); } /** Edit functions **/ if($method=="edit") { $result = mysql_query("SELECT * FROM forum_posts WHERE post_id = '$post_id' AND topic_id = '$topic_id'"); $row = @mysql_fetch_array($result); $post = $row['post']; $post_poster = $row['post_poster']; $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $post_id = $row['post_id']; /** Edit posts **/ if($_POST['edit']) { $post_id = clean($_POST['post_id']); $topic_id = clean($_POST['topic_id']); $post = clean($_POST['post']); /** Error check **/ if(!$post_id || empty($post_id) || !is_numeric($post_id)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Update it **/ mysql_query("UPDATE forum_posts SET post = '$post' WHERE post_id = '$post_id'") or die (mysql_error()); header("Location:index.php?page=forum&mode=viewtopic&t=$topic_id"); /** echo "<meta http-equiv='refresh' content='1; url=index.php?page=forum&mode=viewtopic&t=$topic_id'>"; **/ } } /** End edit function **/ /** Show form **/ ?> <div class="descriptionforum"> User Control Panel - Forums<br />Editing a post. </div> <form action="" name="edit" method="post"> <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" /> <input type="hidden" name="topic_id" value="<?php echo $topic_id; ?>" /> <table class="postreply"> <tr> <td><div align="left"><?php echo STND_LOGGED_IN; ?>: <?php if(!$_SESSION[$prefix.'logged_user']) { echo "Guest"; }else{ echo $_SESSION[$prefix.'logged_user']; }?> </div></td> <td> </td> </tr> <tr> <td colspan="2"> <div align="left"> <textarea name="post" cols="45" rows="5" class="standardforms"><?php echo $post; ?></textarea> </div></td> </tr> <tr> <td> <div align="left"> <input type="submit" name="edit" value="<?php echo FORM_EDIT; ?>" class="standardforms"/> </div></td> <td> </td> </tr> </table> </form> <?php } } } } /** End form **/ /** Start Admin **/ if(!$_GET['mode'] && $_GET['type']=="admin") { /** Deny non admins **/ if(!$_SESSION[$prefix.'logged_user'] || $_SESSION[$prefix.'admin_log']!=1) { $ip = $_SERVER['REMOTE_ADDR']; echo "<p class='message'>This hacking attempt has been logged with your IP address of $ip, also the main admin has been notified of this.<p>"; }else{ /** Set the values **/ $topic_id = clean($_GET['topic_id']); $post_id = clean($_GET['postid']); $method = clean($_GET['method']); /** Error check **/ if(!$topic_id || !is_numeric($topic_id) || !$post_id || !is_numeric($post_id)) { echo "<p class='message'>Died</p>"; exit(0); } /** Delete functions **/ if($method=="delete") { /** Get total posts **/ $totalposts = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$topic_id'") or die (mysql_error()); $totalposts = @mysql_num_rows($totalposts); /** Delete it **/ if($totalposts<2) { mysql_query("DELETE FROM forum_posts WHERE post_id = '$post_id' AND topic_id = '$topic_id'") or die (mysql_error()); mysql_query("DELETE FROM forum_topics WHERE topic_id = '$topic_id'") or die (mysql_error()); echo "<meta http-equiv='refresh' content='2; url=index.php?page=forum'>"; }else{ /** Delete it again **/ mysql_query("DELETE FROM forum_posts WHERE post_id = '$post_id' AND topic_id = '$topic_id'") or die (mysql_error()); echo "<meta http-equiv='refresh' content='1; url=index.php?page=forum&mode=viewtopic&t=$topic_id'>"; } } /** End delete posts **/ /** Delete topics **/ if($method=="delete_topic") { /** Delete it **/ mysql_query("DELETE FROM forum_posts WHERE post_id = '$post_id' AND topic_id = '$topic_id'") or die (mysql_error()); mysql_query("DELETE FROM forum_topics WHERE topic_id = '$topic_id'") or die (mysql_error()); echo "<meta http-equiv='refresh' content='2; url=index.php?page=forum'>";; } /** Edit functions **/ if($method=="edit") { $result = mysql_query("SELECT * FROM forum_posts WHERE post_id = '$post_id' AND topic_id = '$topic_id'"); $row = @mysql_fetch_array($result); $post = $row['post']; $post_poster = $row['post_poster']; $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $post_id = $row['post_id']; /** Edit posts **/ if($_POST['edit']) { $post_id = clean($_POST['post_id']); $topic_id = clean($_POST['topic_id']); $post = clean($_POST['post']); /** Error check **/ if(!$post_id || empty($post_id) || !is_numeric($post_id)) { echo "<p class='message'>".ERROR_EMPTY.".</p>"; }else{ /** Update it **/ mysql_query("UPDATE forum_posts SET post = '$post' WHERE post_id = '$post_id'") or die (mysql_error()); echo "<meta http-equiv='refresh' content='1; url=index.php?page=forum&mode=viewtopic&t=$topic_id'>"; } } /** End edit function **/ /** Show form **/ ?> <div class="descriptionforum"> Admin Control Panel - Forums<br />Editing a post. </div> <form action="" name="edit" method="post"> <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" /> <input type="hidden" name="topic_id" value="<?php echo $topic_id; ?>" /> <table class="postreply"> <tr> <td><div align="left"><?php echo STND_LOGGED_IN; ?>: <?php if(!$_SESSION[$prefix.'logged_user']) { echo "Guest"; }else{ echo $_SESSION[$prefix.'logged_user']; }?> </div></td> <td> </td> </tr> <tr> <td colspan="2"> <div align="left"> <textarea name="post" cols="45" rows="5" class="standardforms"><?php echo $post; ?></textarea> </div></td> </tr> <tr> <td> <div align="left"> <input type="submit" name="edit" value="<?php echo FORM_EDIT; ?>" class="standardforms"/> </div></td> <td> </td> </tr> </table> </form> <?php } } } /** End form **/ if(!$_GET['type'] && $_GET['mode']!="viewtopic") { /** Forum Stats **/ $total_posts = mysql_query("SELECT * FROM forum_posts"); $total_posts = @mysql_num_rows($total_posts); $total_topics = mysql_query("SELECT * FROM forum_topics"); $total_topics = @mysql_num_rows($total_topics); $total_members = mysql_query("SELECT * FROM members"); $total_members = @mysql_num_rows($total_members); ?> <table class="forumfoot"> <tr> <td><?php echo @forum_stats($total_posts,$total_topics); ?></td> <td> </td> </tr> <tr> <td><?php echo @total_online(TOTAL_ONLINE, MEMBERS_ONLINE, GUEST_ONLINE); ?>.<br /> <?php /** Get online members **/ $result = mysql_query("SELECT * FROM online WHERE user_id != 0"); $total = @mysql_num_rows($result); if($total!=0) { $i = 0; /** Loop **/ while($i < $total) { $user_id = mysql_result($result, $i, 'user_id'); $user_ip = mysql_result($result, $i, 'ip'); $time = mysql_result($result, $i, 'time'); /** Get that members information **/ $member = mysql_query("SELECT * FROM members WHERE id = '$user_id'") or die (mysql_error()); $row_member = @mysql_fetch_array($member); $username = $row_member['username']; $location = $row_member['location']; $rank = $row_member['rank']; ?> <a href="index.php?page=members&id=<?php echo $user_id; ?>"><?php echo usernames($username, $rank); ?></a> <?php $i++; } } ?> </td> <td> </td> </tr> <tr> <td colspan="2" class="forumfoottext"><?php echo SITE_TITLE; ?> - Forums</td> </tr> </table> <?php } /** End script **/ ?>
Code:
-- phpMyAdmin SQL Dump
-- version 3.1.2deb1ubuntu0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 13, 2009 at 12:09 AM
-- Server version: 5.0.75
-- PHP Version: 5.2.6-3ubuntu4.2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
--
--
-- --------------------------------------------------------
--
-- Table structure for table `forum_cat`
--
CREATE TABLE IF NOT EXISTS `forum_cat` (
`forum_id` int(150) NOT NULL auto_increment,
`forum_title` varchar(150) NOT NULL,
`forum_desc` varchar(150) NOT NULL,
`forum_active` int(6) NOT NULL,
`forum_password` varchar(150) NOT NULL,
`forum_order` int(15) NOT NULL,
PRIMARY KEY (`forum_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `forum_cat`
--
INSERT INTO `forum_cat` (`forum_id`, `forum_title`, `forum_desc`, `forum_active`, `forum_password`, `forum_order`) VALUES
(1, 'tests', 'eh tikai tests', 1, '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `forum_posts`
--
CREATE TABLE IF NOT EXISTS `forum_posts` (
`post_id` int(150) NOT NULL auto_increment,
`forum_id` int(150) NOT NULL,
`topic_id` int(150) NOT NULL,
`post` blob NOT NULL,
`post_poster` int(150) NOT NULL,
`posters_ip` varchar(150) NOT NULL,
`post_posted` varchar(150) NOT NULL,
PRIMARY KEY (`post_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Table structure for table `forum_topics`
--
CREATE TABLE IF NOT EXISTS `forum_topics` (
`topic_title` varchar(150) NOT NULL,
`forum_id` int(150) NOT NULL,
`topic_poster` int(150) NOT NULL,
`topic_posted` varchar(150) NOT NULL,
`topic_views` varchar(150) NOT NULL,
`topic_id` int(150) NOT NULL auto_increment,
PRIMARY KEY (`topic_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `forum_topics`
--
INSERT INTO `forum_topics` (`topic_title`, `forum_id`, `topic_poster`, `topic_posted`, `topic_views`, `topic_id`) VALUES
('haa ', 1, 1, '1252789177', '2', 1);
-- --------------------------------------------------------
--
-- Table structure for table `settings_forums`
--
CREATE TABLE IF NOT EXISTS `settings_forums` (
`guest_posting` int(6) default NULL,
`forum_active` int(6) default NULL,
`posts_per_page` int(6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `settings_forums`
--
INSERT INTO `settings_forums` (`guest_posting`, `forum_active`, `posts_per_page`) VALUES
(0, 1, 10);
if there is missing parts report me
|