kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Post your full code and lets have a quick look. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 I know some are going to cringe when they see this, sorry, I'm still kinda new! <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> <html> <head> <title>Mafia Syndicate BETA</title> <style type="text/css"> <!-- .style4 {color: #FF0000} .style5 {color: #0000FF} --> </style> </head> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <script language=javascript src=Menus.js></script> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"> <?php include("leftmenu.php");?> </TD> <td width="100%" valign="top"> <br> <?php if ($rankpoints >= 4500){ include "includes/db_connect.php"; include "bb.php"; $delete = strip_tags($_GET['delete']); if($delete && $userlevel>=5) { mysql_query("DELETE FROM forum_question WHERE id='$delete'"); } $sticky = strip_tags($_GET['sticky']); if($sticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '1', important = '0' WHERE id='$sticky'"); } $unsticky = strip_tags($_GET['unsticky']); if($unsticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unsticky'"); } $important = strip_tags($_GET['important']); if($important && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '1' WHERE id='$important'"); } $unimportant = strip_tags($_GET['unimportant']); if($unimportant && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unimportant'"); } $lock = strip_tags($_GET['lock']); if($lock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock'"); } $userlock = strip_tags($_GET['userlock']); if($userlock) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock' AND username='$username'"); } $unlock = strip_tags($_GET['unlock']); if($unlock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='0' WHERE id='$unlock'"); } if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])){ $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=time(); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == $topic){// you allready had $topic set so why not just use that and make life easyer echo "There is already a topic with this title!"; }else{ $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); } $datetime=date("d/m/y h:i:s"); //create date time if ($title == $_POST['title']){ echo "You must add a title!"; } } // you missed this }// and this.... make sure you braces are closed else{ mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($$_POST['title'] !="" && $content !=""){ $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$title', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } mysql_query("DELETE FROM forum_question WHERE title=''"); $sql="SELECT * FROM forum_question WHERE sticky='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result=mysql_query($sql); $username=$_SESSION['username']; ?> <table border="1" cellspacing="0" cellpadding="0" bordercolor="black" align="center" width="75%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Main Forum </td> </tr> <?php include "includes/db_connect.php"; $sql3="SELECT * FROM forum_question WHERE important='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result3=mysql_query($sql3); ?> <?php while($rows3=mysql_fetch_array($result3)){ $locked = $rows3['locked']; ?> <tr> <td width="92%" border="0" ><font color=red>IMPORTANT:</font> <a href="view_topic.php?id=<? echo $rows3['id']; ?>"><? echo forumbb($rows3['title']); ?></a> <? if ($locked == 1) {?> <span class="style4">(Locked)</span> <? } ?></td> <td width="8%" align="right"><? echo $rows3['reply']; ?></td> </tr> <?php } ?> <?php while($rows=mysql_fetch_array($result)){ $locked = $rows['locked']; ?> <tr> <td width="92%" border="0" ><span class="style5">STICKY:</span> <a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo forumbb($rows['title']); ?></a> <? if ($locked == 1) {?> <span class="style4">(Locked)</span> <? } ?></td> <td width="8%" align="right"><? echo $rows['reply']; ?></td> </tr> <?php } ?> <?php $sql2="SELECT * FROM forum_question WHERE sticky='0' AND important='0' AND place='main' ORDER BY lastreply DESC, reply DESC LIMIT 30"; $result2=mysql_query($sql2); while($rows2=mysql_fetch_array($result2)){ $locked = $rows2['locked']; ?> <tr> <td width="92%" border="0" ><a href="view_topic.php?id=<? echo $rows2['id']; ?>"><? echo htmlentities($rows2['title']); ?></a> <? if ($locked == 1) {?> <span class="style4">(Locked)</span> <? } ?> </td> <td width="8%" align="right"><? echo $rows2['reply']; ?></td> </tr> <?php } ?> </table> <center><form action="Forum.php" method="post"> Title:<br> <input name="title" style="border:1px solid black;" class="tbox" type="text"><br> Content:<br> <textarea name="content" style="border:1px solid black;" class="tbox" cols="50" rows="8"></textarea><br><br> <center><input name="Submit" type="submit" class="tbox" value="Post topic!"></center> </form></center> <br><br> <? if ($userlevel >= 10) { ?> <center><a href="wipeforum.php"><font color="#FF0000">*<b>Clear Forum</b></font></a></center><? } ?> <br><br> </td> <? }else{ echo "<center><br><br><font color=red><b>You must be a Respectable Badman, Before you can use The Forum!</b></color></center>";} ?> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi I have had a try at cleaning that up and making the indentations match. Also added or die(mysql_error()) to each of the queries to throw out any errors. Try it like this and hopefully it will be easier to follow. My guess is that one of the bits of SQL is invalid and hence why the writes are not working. <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } ?> <html> <head> <title>Mafia Syndicate BETA</title> <style type="text/css"> <!-- .style4 {color: #FF0000} .style5 {color: #0000FF} --> </style> </head> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <script language=javascript src=Menus.js></script> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"> <?php include("leftmenu.php");?> </TD> <td width="100%" valign="top"> <br> <?php if ($rankpoints >= 4500) { include "includes/db_connect.php"; include "bb.php"; $delete = strip_tags($_GET['delete']); if($delete && $userlevel>=5) { mysql_query("DELETE FROM forum_question WHERE id='$delete'") or die(mysql_error()); } $sticky = strip_tags($_GET['sticky']); if($sticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '1', important = '0' WHERE id='$sticky'") or die(mysql_error()); } $unsticky = strip_tags($_GET['unsticky']); if($unsticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unsticky'") or die(mysql_error()); } $important = strip_tags($_GET['important']); if($important && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '1' WHERE id='$important'") or die(mysql_error()); } $unimportant = strip_tags($_GET['unimportant']); if($unimportant && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unimportant'") or die(mysql_error()); } $lock = strip_tags($_GET['lock']); if($lock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock'") or die(mysql_error()); } $userlock = strip_tags($_GET['userlock']); if($userlock) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock' AND username='$username'") or die(mysql_error()); } $unlock = strip_tags($_GET['unlock']); if($unlock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='0' WHERE id='$unlock'") or die(mysql_error()); } if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])) { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=time(); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40") or die(mysql_error()); $info = mysql_fetch_object($query); if ($info->title == $topic) {// you allready had $topic set so why not just use that and make life easyer echo "There is already a topic with this title!"; } else { //NOT A CLUE WHAT THIS IS HERE FOR $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); } $datetime=date("d/m/y h:i:s"); //create date time if ($title == $_POST['title']) { echo "You must add a title!"; } } // you missed this }// and this.... make sure you braces are closed else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($_POST['title'] !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$title', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql) or die(mysql_error()); } } mysql_query("DELETE FROM forum_question WHERE title=''"); $sql="SELECT * FROM forum_question WHERE sticky='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result=mysql_query($sql) or die(mysql_error()); $username=$_SESSION['username']; ?> <table border="1" cellspacing="0" cellpadding="0" bordercolor="black" align="center" width="75%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Main Forum </td> </tr> <?php include "includes/db_connect.php"; $sql3="SELECT * FROM forum_question WHERE important='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result3=mysql_query($sql3) or die(mysql_error()); while($rows3=mysql_fetch_array($result3)) { $locked = $rows3['locked']; echo '<tr><td width="92%" border="0" ><font color=red>IMPORTANT:</font><a href="view_topic.php?id='.$rows3['id'].'">'.forumbb($rows3['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'.$rows3['reply'].'</td></tr>'; } while($rows=mysql_fetch_array($result)) { $locked = $rows['locked']; echo '<tr><td width="92%" border="0" ><span class="style5">STICKY:</span><a href="view_topic.php?id='.$rows['id'].'">'.forumbb($rows['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'.echo $rows['reply'].'</td></tr>'; } $sql2="SELECT * FROM forum_question WHERE sticky='0' AND important='0' AND place='main' ORDER BY lastreply DESC, reply DESC LIMIT 30"; $result2=mysql_query($sql2) or die(mysql_error()); while($rows2=mysql_fetch_array($result2)) { $locked = $rows2['locked']; echo '<tr><td width="92%" border="0" ><a href="view_topic.php?id='.$rows2['id'].'">'.htmlentities($rows2['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'.$rows2['reply'].'</td></tr>'; } ?> </table> <center><form action="Forum.php" method="post"> Title:<br> <input name="title" style="border:1px solid black;" class="tbox" type="text"><br> Content:<br> <textarea name="content" style="border:1px solid black;" class="tbox" cols="50" rows="8"></textarea><br><br> <center><input name="Submit" type="submit" class="tbox" value="Post topic!"></center> </form></center> <br><br> <? if ($userlevel >= 10) { echo '<center><a href="wipeforum.php"><font color="#FF0000">*<b>Clear Forum</b></font></a></center>'; } ?> <br><br> </td> <? } else { echo "<td><center><br><br><font color=red><b>You must be a Respectable Badman, Before you can use The Forum!</b></color></center></td>"; } ?> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> </center> </body> </html> All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 I really appreciate that Keith! I just copied and pasted into my file and got this when trying to open my page: Parse error: syntax error, unexpected T_ECHO in /home/klrbal/public_html/Mafia-test/Forum.php on line 668 I wish I could make you an admin of my game and let ya help me with this:lol: Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Not sure where line 668 comes from (there are only 209 lines!). However spotted a typo on line 160:- echo '</td><td width="8%" align="right">'.echo $rows['reply'].'</td></tr>'; The echo highlighted in red shouldn't be there. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 I saw what happened, my browser was double spacing. I have fixed that, and now I get all the way through submitting the topic, then I get no errors, it just doesn't post anything :S. Can I pay someone to go through my scripts and see all my errors for me? I know it will take time, but I'm willing to pay for it! I'm in DIRE need to get this up as all my players are getting frustrated that my server isn't up/working right right now Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Keep trying! Think to do anymore we need the other scripts, or at least the form that is being submitted that isn't resulting in anything being posted. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 As far as I know, everything on my forum is contained into that one script (adding, deleting, modifying) stuff like that. Do you think it's just not writing to my db properly or at all? Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted October 16, 2009 Share Posted October 16, 2009 Did you try using phpMyAdmin to look inside of your actual database? If there is nothing there, then yes, it isn't writing to it. Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Found an issue. It appears to be a change done between when you first started this thread and when you reposted your code which I edited, with some curley braces being closed early. Find the code where it checks $_POST['submit'] and replace the short section of code after it with:- if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])) { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=time(); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == "$topic") { echo "There is already a topic with this title!"; } else { $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($title == "") { echo "You must add a title!"; } else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($title !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$title', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } } } } This code is pretty much the same except for the braces moved around a bit. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 Hi Found an issue. It appears to be a change done between when you first started this thread and when you reposted your code which I edited, with some curley braces being closed early. Find the code where it checks $_POST['submit'] and replace the short section of code after it with:- (if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])) { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == "$topic") { echo "There is already a topic with this title!"; } else { $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($title == "") { echo "You must add a title!"; } else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($title !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$title', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } } } } Updated code to: <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } ?> <html> <head> <title>Mafia Syndicate BETA</title> <style type="text/css"> <!-- .style4 {color: #FF0000} .style5 {color: #0000FF} --> </style> </head> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <script language=javascript src=Menus.js></script> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"> <?php include("leftmenu.php");?> </TD> <td width="100%" valign="top"> <br> <?php if ($rankpoints >= 4500) { include "includes/db_connect.php"; include "bb.php"; $delete = strip_tags($_GET['delete']); if($delete && $userlevel>=5) { mysql_query("DELETE FROM forum_question WHERE id='$delete'") or die(mysql_error()); } $sticky = strip_tags($_GET['sticky']); if($sticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '1', important = '0' WHERE id='$sticky'") or die(mysql_error()); } $unsticky = strip_tags($_GET['unsticky']); if($unsticky && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unsticky'") or die(mysql_error()); } $important = strip_tags($_GET['important']); if($important && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '1' WHERE id='$important'") or die(mysql_error()); } $unimportant = strip_tags($_GET['unimportant']); if($unimportant && $userlevel>=5) { mysql_query("UPDATE forum_question SET sticky = '0', important = '0' WHERE id='$unimportant'") or die(mysql_error()); } $lock = strip_tags($_GET['lock']); if($lock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock'") or die(mysql_error()); } $userlock = strip_tags($_GET['userlock']); if($userlock) { mysql_query("UPDATE forum_question SET locked='1' WHERE id='$lock' AND username='$username'") or die(mysql_error()); } $unlock = strip_tags($_GET['unlock']); if($unlock && $userlevel>=5) { mysql_query("UPDATE forum_question SET locked='0' WHERE id='$unlock'") or die(mysql_error()); } (if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])); { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == "$topic") { echo "There is already a topic with this title!"; } else { $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($title == "") { echo "You must add a title!"; } else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($title !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$title', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } } } } mysql_query("DELETE FROM forum_question WHERE title=''"); $sql="SELECT * FROM forum_question WHERE sticky='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result=mysql_query($sql) or die(mysql_error()); $username=$_SESSION['username']; ?> <table border="1" cellspacing="0" cellpadding="0" bordercolor="black" align="center" width="75%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Main Forum </td> </tr> <?php include "includes/db_connect.php"; $sql3="SELECT * FROM forum_question WHERE important='1' AND place='main' ORDER BY lastreply DESC, reply DESC"; $result3=mysql_query($sql3) or die(mysql_error()); while($rows3=mysql_fetch_array($result3)) { $locked = $rows3['locked']; echo '<tr><td width="92%" border="0" ><font color=red>IMPORTANT:</font><a href="view_topic.php?id='.$rows3['id'].'">'.forumbb($rows3['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'.$rows3['reply'].'</td></tr>'; } while($rows=mysql_fetch_array($result)) { $locked = $rows['locked']; echo '<tr><td width="92%" border="0" ><span class="style5">STICKY:</span><a href="view_topic.php?id='.$rows['id'].'">'.forumbb($rows['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'. $rows['reply'].'</td></tr>'; } $sql2="SELECT * FROM forum_question WHERE sticky='0' AND important='0' AND place='main' ORDER BY lastreply DESC, reply DESC LIMIT 30"; $result2=mysql_query($sql2) or die(mysql_error()); while($rows2=mysql_fetch_array($result2)) { $locked = $rows2['locked']; echo '<tr><td width="92%" border="0" ><a href="view_topic.php?id='.$rows2['id'].'">'.htmlentities($rows2['title']).'</a>'; if ($locked == 1) { echo '<span class="style4">(Locked)</span>'; } echo '</td><td width="8%" align="right">'.$rows2['reply'].'</td></tr>'; } ?> </table> <center><form action="Forum.php" method="post"> Title:<br> <input name="title" style="border:1px solid black;" class="tbox" type="text"><br> Content:<br> <textarea name="content" style="border:1px solid black;" class="tbox" cols="50" rows="8"></textarea><br><br> <center><input name="Submit" type="submit" class="tbox" value="Post topic!"></center> </form></center> <br><br> <? if ($userlevel >= 10) { echo '<center><a href="wipeforum.php"><font color="#FF0000">*<b>Clear Forum</b></font></a></center>'; } ?> <br><br> </td> <? } else { echo "<td><center><br><br><font color=red><b>You must be a Respectable Badman, Before you can use The Forum!</b></color></center></td>"; } ?> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> </center> </body> </html> [/code] and got this: Parse error: syntax error, unexpected T_IF in /home/klrbal/public_html/Mafia-test/Forum.php on line 85 This code is pretty much the same except for the braces moved around a bit. All the best Keith Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi 2 extra characters have snuck in on line 85 when you are editing it:- (if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])); Remove those 2 highlighted in red. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 Fixed the 2 extras, and got this: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/klrbal/public_html/Mafia-test/Forum.php on line 101 You must add a title! Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Missing * in the SQL:- $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40"); All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 It says I need to add a title. You think it might be a good idea to just make a new db? I took my sql file from my old one and uploaded it to this db. You think I should just re-make it? Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi No, not when it is almost there. Issue seems to be that in the following section of code you have taken the form field called title and put it into $topic. Either change $topic to $title, or update the references to $title to $topic like this:- if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])) { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == "$topic") { echo "There is already a topic with this title!"; } else { $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($topic == "") { echo "You must add a title!"; } else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($topic !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$topic', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } } } } All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 Hi No, not when it is almost there. Issue seems to be that in the following section of code you have taken the form field called title and put it into $topic. Either change $topic to $title, or update the references to $title to $topic like this:- if ($_POST['Submit'] && strip_tags($_POST['title']) && strip_tags($_POST['content'])) { $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == "$topic") { echo "There is already a topic with this title!"; } else { $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($topic == "") { echo "You must add a title!"; } else { mysql_query("UPDATE forum_question SET new='0' WHERE new='1'"); if ($topic !="" && $content !="") { $sql="INSERT INTO forum_question(title, content, datetime, username, place, lastreply)VALUES('$topic', '$content','$datetime', '$username', 'main', '$time')"; $result=mysql_query($sql); } } } } } Parse error: syntax error, unexpected ')' in /home/klrbal/public_html/Mafia-test/Forum.php on line 93 All the best Keith Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi $time=time(); Not sure where they time( went. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 fixed the $time and got this Parse error: syntax error, unexpected ')' in /home/klrbal/public_html/Mafia-test/Forum.php on line 93 lol, sorry if this is annoying I wish it was something easy. I REALLY appreciate your help though, it means a lot to me. Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi That is the same error again. Can you post what you have changed the line to. All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=(); if ($mute == 1) { Quote Link to comment Share on other sites More sharing options...
cags Posted October 16, 2009 Share Posted October 16, 2009 As kickstart already said, it should be $time=time(); not $time = (); which doesn't even make any sense. Talk about writing a script by proxy... Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 Ok, fixed again. Now it's just not posting. Again, it will submit, won't write to the database, and doesn't post it on the forum. Quote Link to comment Share on other sites More sharing options...
kickstart Posted October 16, 2009 Share Posted October 16, 2009 Hi Add or die(mysql_error()); onto the end of the query lines to see if an error is put out. Eg:- $result=mysql_query($sql) or die(mysql_error()); All the best Keith Quote Link to comment Share on other sites More sharing options...
Leveecius Posted October 16, 2009 Author Share Posted October 16, 2009 I added the $result=mysql_query($sql) or die(mysql_error()); to each, now it does the same thing, doesn't post, doesn't write, nothing, HOWEVER, I do get a [/code] under my right side menu for no apparent reason at all :S 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.