Jump to content

Help with my forum problems


Leveecius

Recommended Posts

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

I know some are going to cringe when they see this, sorry, I'm still kinda new! :P

<?
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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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 :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.