AdamHull Posted May 27, 2011 Share Posted May 27, 2011 i am have a forum script and i need some help as it is not showing the topics or creating the topics can some one help please these are my codes the first one is where the main part of the forum is <?php session_start(); include_once("includes/db_connect.php"); include_once("includes/functions.php"); include_once("includes/smile.php"); logincheck(); $username=$_SESSION['username']; $fetch = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username` = '$username'")); $re = makesafe($_GET['re']); $forum = makesafe($_GET['forum']); if(!$_GET['forum']){ $forum = $fetch->forum; } if($re){ $target = "right"; }else{ $target = "_self"; } $view = makesafe($_GET['view']); $crew = $fetch->crew; $change = makesafe($_GET['change']); $id = makesafe($_GET['id']); $crew = $fetch->crew; if($_GET['give']){ $give = makesafe($_GET['give']); if($fetch->userlevel == "0"){ echo"You cant give respect, your not staff!"; } elseif($fetch->userlevel == "4" || $fetch->userlevel == "1"){ mysql_query("UPDATE users SET respect=respect+50 WHERE username='$give'"); echo " <SCRIPT LANGUAGE='JavaScript'> window.location='forum2.php?forum=$forum&view=topic&id=$id'; </script>"; }} if($_GET['take']){ $take = $_GET['take']; if($fetch->userlevel == "0"){ echo"You cant take respect, your not staff!"; } elseif($fetch->userlevel == "4" || $fetch->userlevel == "1"){ mysql_query("UPDATE users SET respect=respect-50 WHERE username='$take'"); echo " <SCRIPT LANGUAGE='JavaScript'> window.location='forum2.php?forum=$forum&view=topic&id=$id'; </script>"; }} //This is the value that sets how long the user must wait after posting or creating a topic (In Minutes) - 0 for none. define("POSTTIMER", 2.5); ////page//// $query_count = "SELECT * FROM `topics` WHERE forum='$forum'"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); $query="SELECT * FROM `topics` WHERE forum='$forum' ORDER BY `lastreply` DESC LIMIT 68, $totalrows"; $query=mysql_query("$query"); while($fo=mysql_fetch_object($query)){ mysql_query("DELETE FROM topics WHERE id='$fo->id'"); mysql_query("DELETE FROM replys WHERE idto='$fo->id'"); } ////page//// //If you have any other forums other than the ones below please add them... Case sensitive if(!in_array($forum, array('NewsUpdatesNotices', 'Chat', 'PictureProfile', 'Ads', 'OCBJAds', 'HelpBugsSuggestions', 'crew'))){ die; } if($fetch->userlevel == "0"){ if(!$crew && $forum == 'crew'){ die("You Are Not In A Crew."); } } $fetchc=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1")); $forumm = 0; if($forum == "crew"){ if(($fetchc->owner == $username) || ($fetchc->underboss == $username) || ($fetchc->lhm == $username) || ($fetchc->rhm == $username)){ $forumm = 1; }} if($fetch->userlevel == "3" || $fetch->userlevel == "4" || $fetch->userlevel == "1"){ $forumm = 1; } if($forum == 'crew' && $crew) { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' AND `crew` = '$crew' ORDER BY `sticky` DESC, `lastreply` DESC"); } else { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' ORDER BY `sticky` DESC, `lastreply` DESC"); } $totalTopics = mysql_num_rows($getTopics); $topics_per_page = 20; $offset = (int)$_GET['fpage'] * $topics_per_page; $pages = ceil($totalTopics / $topics_per_page); for ($i=0;$i<$pages;$i++) { $n = $i+1; if ($_GET['fpage'] == $i) { $page .= "<b>$n</b> "; } else { $page .= "<a href='forumn.php?forum=$forum&fpage=$i'>$n</a> "; }} if($forum == 'crew' && $crew) { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' AND `crew` = '$crew' ORDER BY `sticky` DESC, `lastreply` DESC LIMIT $offset, $topics_per_page"); } else { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' ORDER BY `lastreply` DESC LIMIT $offset, $topics_per_page"); } if($forumm == 1){ $topicListOptions = "<tr><td colspan='6' class='sortbottom' align='center'>With Selected: <select name='forumOptionsList' class='text'><option value='delete'>Delete</option><option value='impUnimp'>Important/Unimportant</option><option value='stickUnstick'>Stick/Unstick</option><option value='lockUnlock'>Lock/Unlock</option><option value='clearTopic'>Clear</option></select> <input type='submit' class='custombutton' name='forumOptionsSubmit' value='Go' class='text' /></td></tr>"; } if($re){ $createTitle = "<a href='forum2.php?forum=$forum&view=newTopic' target='$target' class=\"style5\"><font color='white'>New Topic</font></a> / <a href='newForum.php?forum=$forum&change=true' target='$target' class=\"style5\"><font color='white'>Set as Default.</font></a> / <a href='newForum.php?change=false' target='$target' class=\"style5\"><font color='white'>Categories</font></a>"; }else{ $createTitle = "<a href='forum2.php?forum=$forum&view=newTopic' target='$target' class=\"style4\"><font color='white'>New Topic</font></a> / <a href='newForum.php?forum=$forum&change=true' target='$target' class=\"style4\"><font color='white'>Set as Default.</font></a> / <a href='newForum.php?change=false' target='$target' class=\"style4\"><font color='white'>Categories</font></a>"; $createTitle2 = ""; } if($forumm == 1 && $_POST['checkbox'] != '') { $option = makesafe($_POST['forumOptionsList']); if($option == 'delete') { foreach($_POST['checkbox'] as $id) { mysql_query("DELETE FROM `topics` WHERE `id` = '$id'"); mysql_query("DELETE FROM `replys` WHERE `idto` = '$id'"); mysql_query("DELETE FROM `topic_votes_new` WHERE `idto` = '$id'"); } } elseif($option == 'stickUnstick') { foreach($_POST['checkbox'] as $id) { $fetchStickTopic = mysql_fetch_array(mysql_query("SELECT `sticky` FROM `topics` WHERE `id` = '$id'")); if($fetchStickTopic[sticky] == 1){ mysql_query("UPDATE `topics` SET `sticky` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `sticky` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'impUnimp') { foreach($_POST['checkbox'] as $id) { $fetchImpTopic = mysql_fetch_array(mysql_query("SELECT `imp` FROM `topics` WHERE `id` = '$id'")); if($fetchImpTopic[imp] == 1){ mysql_query("UPDATE `topics` SET `imp` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `imp` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'lockUnlock') { foreach($_POST['checkbox'] as $id) { $fetchLockTopic = mysql_fetch_array(mysql_query("SELECT `locked` FROM `topics` WHERE `id` = '$id'")); if($fetchLockTopic[locked] == 1){ mysql_query("UPDATE `topics` SET `locked` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `locked` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'clearTopic') { foreach($_POST['checkbox'] as $id) { mysql_query("DELETE FROM `replys` WHERE `idto` = '$id'"); } } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style4 { font-size: 18px; font-weight: bold; }.style5 { font-size: 13px; font-weight: bold; } --> </style> </head> <link rel="stylesheet" type="text/css" href="example.css"/> <script type="text/javascript" src="sortable.js"></script> <body><form method="post" action="" name="dd" id="dd"> <table width="<?php if($re){ echo"99%"; }else{ echo"600"; }?>" align="center" cellpadding="0" cellspacing="0" class="thinline" id="anyid"> <tr class="unsortable"> <td colspan="3" class="topic"><span ><?php echo"$createTitle"; ?></span></td> </tr> </table> <table width="<?php if($re){ echo"99%"; }else{ echo"600"; }?>" align="center" cellpadding="0" cellspacing="0" class="sortable" id="anyid"> <tr> <th width="360" >Title</th> <?php if(!$re){ ?> <th width="15%"><span style="cursor: help">Views</span></th> <th width="15%"><span style="cursor: help">Posts</span></th> <th width='15%'><span style="cursor: help">Username</span></th><?php } ?> <?php if($forumm == 1){ ?> <th width='23' class="unsortable"></th> <?php } ?> </tr> <? while($p=mysql_fetch_object($getTopics)){ if($p->sticky == "1" && $p->options == ""){ $pic2 = "<font color=orange><b>Sticky</b>:</font>"; $pic = ""; }elseif($p->sticky == "0" && $p->options == ""){ $pic2 = ""; $pic = " <img src='../images/folder.jpg'> "; }elseif($p->sticky == "0" && $p->options != ""){$pic2 = "<font color=black>Poll:</font>"; $pic = " <img src='../images/poll.jpg'> "; } if($p->imp == "1"){ $pic2 = "<font color=red><u><b>Important</b></u>:</font>"; $pic = " <img src='../images/imp.png'> "; $mess = ""; } if($p->locked == "1"){ $lock = "<font color=black><b>(Locked)</b></font>"; }else{ $lock =""; } $title2 = lang($p->title); $title = "$pic2 <a href='forum2.php?forum=$forum&view=topic&id=$p->id$addOn' class='thumbnail' target='$target'><font color='$col23'>$title2</font></a> $lock"; $posts = mysql_num_rows(mysql_query("SELECT `id` FROM `replys` WHERE `idto` = '$p->id'")); if(!$re){ $pu = " <td width='15%' class=\"tableborder\" align=\"center\">$p->views</td> <td width='15%' class=\"tableborder\" align=\"center\">$posts</td> <td width='15%' class=\"tableborder\" align=\"center\">$p->username</td>"; }else{ $pu = ""; } if($forumm == 1){ $listo = "<td align='center' height='5' width='5%'><input type='checkbox' style='height: 5px;' name='checkbox[]' value='$p->id'></td>"; } echo "<tr > <td class=\"tableborder\" height=\"24\" align=\"center\">$title</td> $pu $listo </tr>"; } ?><tfoot> <tr> <td colspan='5' class='sortbottom' align='center'><?=$page?></td> </tr> <?=$topicListOptions?> </tfoot> </table></form> </body> </html> Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 27, 2011 Share Posted May 27, 2011 first have you added the sqls to your database? Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 27, 2011 Share Posted May 27, 2011 Use error_reporting(E_ALL); to see what the page shows. If the page is already showing errors then please post them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.