Jump to content

My forum


thegod

Recommended Posts

its not input the text in the Mysql database when people reply please help here is the code thanks to everyone who helps

<?php
include_once 'includes/functions.php'; 
include_once 'includes/replace.php';
logincheck();

$forum=$_GET['forum'];
$username=$_SESSION['username'];
$viewtopic = $_GET['viewtopic'];
$forum_look=$_GET['forum_look'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));
$forumquote = mysql_query("SELECT * FROM user_info WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);

if (!$viewtopic){
$viewtopic = "1";
}

$fetch=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));
if ($forum == "Crew" && $fetch->crew != "0"){
$crew="1";
}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$username' OR rhm='$username'"));


$userlevel=$fetch->userlevel;





$ggee = mysql_query("SELECT locked, sticky, lastreply FROM topics WHERE id='$viewtopic' AND forum='$forum'");
while($dsdsd = mysql_fetch_row($ggee)){
$lockedornot = $dsdsd[0];
$stikornot = $dsdsd[1];
$lastreplyit = $dsdsd[2];
}

if ($lockedornot == '1'){
echo "This topic is locked.";
}elseif ($userlevel != '0' || $lockedornot != '1'){

if ($crew == "1"){
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum' AND crew='$fetch->crew'");
}else{
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'");
}
while($success = mysql_fetch_row($gg)){
$username1 = $success[1];
$topictext = $success[3];
$made = $success[8];

}

$forumquote2 = mysql_query("SELECT * FROM user_info WHERE username = '$username1'");
$fq2 = mysql_fetch_object($forumquote2);


?>
<style type="text/css">
<!--
.style2 {font-size: 10px}
-->
</style>

<link href="includes/forum.css" rel="stylesheet" type="text/css">


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #666666;
background-image: url(index_images/armour/background.jpg);
}
.style3 {color: #FFFFFF}
-->
</style><table width=100% border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 class=thinline>
<tr>
<td class="header" colspan=2><center>Topic Made By : <? echo "<a href='profile.php?viewuser=$username1' target=mainFrame>$username1</a>"; ?> On :<?php echo "$made"; ?></td>
</tr>
<tr>
<td width='8%' rowspan='3' bgcolor=#777777>
<center>
<img src='<? echo"$fq2->forumpic"; ?>' hight='65' width='65' align='center'>
<span class=style2><? echo"$fq2->posts"; ?> Posts</span>






</td>
</tr>

<tr>
<td height="134" bgcolor="#777777">
<? echo replace($topictext); 
if ($topictext == ""){ $topictext = "Main Forum";}?></td>
</tr>
<tr>
<td height='21' colspan='1' bgcolor=#777777>
  <div align=center><? echo"$fetch->forumquote"; ?></div></td>

</tr>
</table><br>
<p>


<?php

$forum_count = 15;

function index_navigation($index, $count, $num) {
$forum = $_GET['forum'];
$viewtopic = $_GET['viewtopic'];
if ($index != 0) {
	print "<a class='linktext' href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
	print " <a class='linktext' href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index + $count) . "\">Next</a>";
}


}
if (! isset($forum_look) ) {
			$forum_look = 0;
		}
if ($crew == "1"){
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' AND crew='$fetch->crew' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}else{
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
while($right=mysql_fetch_object($query)){


if ($fetch->userlevel == "0"){
$forumquote = mysql_query("SELECT * FROM user_info WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);

if($fq->gender == "Dont State") { $gender = "ds.PNG"; }
if($fq->gender == "Male") { $gender = "male.gif"; }
if($fq->gender == "Female") { $gender = "female.gif"; }
if ($fq->posts >= "0" && $fq->posts < "80"){ $forumrank = "Forum Bum"; }
if ($fq->posts >= "81" && $fq->posts < "160"){ $forumrank = "Curb Crawler"; }
if ($fq->posts >= "161" && $fq->posts < "220"){ $forumrank = "Post Star"; }
if ($fq->posts >= "221" && $fq->posts < "290"){ $forumrank = "V.I.Poster"; }
if ($fq->posts >= "291"){ $forumrank = "Post Whore"; }

if ($fq->posts >= "0" && $fq->posts < "80"){ $forumpic = "1.jpg"; }
if ($fq->posts >= "81" && $fq->posts < "160"){ $forumpic = "2.jpg"; }
if ($fq->posts >= "161" && $fq->posts < "220"){ $forumpic = "3.jpg"; }
if ($fq->posts >= "221" && $fq->posts < "290"){ $forumpic = "4.jpg"; }
if ($fq->posts >= "291"){ $forumpic = "5.jpg"; }

echo "<table width=100% height=178 border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 class=\"background\">
<tr>
<td height=21 colspan=2 class=\"header\"><div align=center><a href='profile.php?viewuser=$right->username' target=mainFrame>$right->username</a> <b>On:</b> $right->made</div></td>
</tr>
<tr>
<td width='8%' rowspan='3' bgcolor=#777777>
<center>
<img src='$fq->forumpic' hight='65' width='65' align='center'>
<span class=style2>$fq->posts Posts</span>
<img src='$forumpic'>
<span class=style2>$forumrank</span>

<br><img src='$gender'>

</td>
</tr>

<tr>
<td width=92% height='134' class='topictext' bgcolor='#ffffff'>";

echo replace($right->text);


echo "</td>

</tr>
<tr>
<td height='21' colspan='1' bgcolor=#ffffff>
  <div align=center><font color=000000>$fq->forumquote</div></td>
</tr>
</table><br>
<p>";
}elseif ($fetch->userlevel =! "0"){

$forumquote = mysql_query("SELECT * FROM user_info WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);

if($fq->gender == "Dont State") { $gender = "ds.PNG"; }
if($fq->gender == "Male") { $gender = "male.gif"; }
if($fq->gender == "Female") { $gender = "female.gif"; }
if ($fq->posts >= "0" && $fq->posts < "80"){ $forumrank = "Forum Bum"; }
if ($fq->posts >= "81" && $fq->posts < "160"){ $forumrank = "Curb Crawler"; }
if ($fq->posts >= "161" && $fq->posts < "220"){ $forumrank = "Post Star"; }
if ($fq->posts >= "221" && $fq->posts < "290"){ $forumrank = "V.I.Poster"; }
if ($fq->posts >= "291"){ $forumrank = "Post Whore"; }

if ($fq->posts >= "0" && $fq->posts < "80"){ $forumpic = "1.jpg"; }
if ($fq->posts >= "81" && $fq->posts < "160"){ $forumpic = "2.jpg"; }
if ($fq->posts >= "161" && $fq->posts < "220"){ $forumpic = "3.jpg"; }
if ($fq->posts >= "221" && $fq->posts < "290"){ $forumpic = "4.jpg"; }
if ($fq->posts >= "291"){ $forumpic = "5.jpg"; }

echo "<table width=100% height=178 border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 class=\"background\">
<tr>
<td height=21 colspan=2 class=\"header\"><div align=center><a href='right.php?clean=$right->id&forum=$forum&viewtopic=$viewtopic'><font color=red>Delete</font></a>    <a href='profile.php?viewuser=$right->username' target=mainFrame>$right->username</a> <b>On:</b> $right->made</div></td>
</tr>
<tr>
<td width='8%' rowspan='3' bgcolor=#777777>
<center>
<img src='$fq->forumpic' hight='65' width='65' align='center'>

<span class=style2>$fq->posts Posts</span>
<img src='$forumpic'>
<span class=style2>$forumrank</span>


<br><img src='$gender'>
</td>
</tr>

<tr>
<td width=92% height='134' class='topictext'  bgcolor='#ffffff'>";

echo replace($right->text);


echo "</td>

</tr>
<tr>
<td height='21' colspan='1' bgcolor=#ffffff>
  <div align=center><font color=000000>$fq->forumquote</div></td>
</tr>
</table><br>
<p>";
}



}

if($_GET[clean]) { 
$clean=$_GET[clean];
if($userlevel == '0'){
echo "Error.";
exit;
}else
mysql_query("DELETE FROM replys WHERE id='$clean' AND forum='$forum'") or die ("Cannot delete reply");
echo "Reply Deleted";
echo "<SCRIPT LANGUAGE='JavaScript'>
window.location='right.php?forum=$forum&viewtopic=$g';
</script>";

}





?>
<?php
index_navigation($forum_look, $forum_count, $num);	
?>





<br>

<br>


<?

if (!$viewtopic){
$viewtopic = "1";
}

if(strip_tags($_POST['Submit']) && strip_tags($_POST['reply_text']) && $forum && $viewtopic){

$reply_text =addslashes(strip_tags($_POST['reply_text']));

$topic_info=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE  id='$viewtopic' AND forum='$forum'"));


if ($topic_info->sticky == "1"){
$lastreplytime = $topic_info->lastreply;
}elseif ($stikornot == "0"){
$lastreplytime = time();
}
if ($topic_info->locked == "1"){
echo "This topic is locked.";
exit();
}


$date = gmdate('Y-m-d h:i:s');





if ($crew == "1" && $fetch->crew != "0"){
mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`,`crew`) VALUES ('', '$username', '$reply_text', '$forum', '$viewtopic','$date','$fetch->crew');") or die (mysql_error());


mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`) VALUES ('', '$username', '$reply_text', '$forum', '$viewtopic','$date');") or die (mysql_error());

}
mysql_query("UPDATE `user_info` SET `posts` = `posts`+1 WHERE username='$username'");

		mysql_query("UPDATE topics SET lastreply='$lastreplytime' WHERE id='$viewtopic' AND sticky='0'");

mysql_query("UPDATE `user_info` SET `posts` = `posts`+1 WHERE username='$username'");
echo "

<SCRIPT LANGUAGE='JavaScript'>
window.location='right.php?forum=$forum&viewtopic=$viewtopic';
</script>";

}
?>


<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){ 
if (dis.elements[i].type=='submit')
   dis.elements[i].style.visibility='hidden';
}
if(fs==false){
	 fs=true;
	 return true;
}else
		return false;
}
function goaway()
{
for(i=0;i<document.forms.length;i++)
document.forms[i].onsubmit = function() {return so(this);};
}
</script><body onload=goaway();>


<form action='' method=post>
<input name="forumto" type="hidden" value="<?php echo "$forum"; ?>">
        <input name="this" type="hidden" id="this" value="<?php echo "$viewtopic"; ?>">

<center><a href="bbcode.php"><img src="bbcodes.jpg" width="65" height="20" border="0"></a>  <a href="color.php"><img src="colours.jpg" width="65" height="20" border="0"></a>
</center>



  <table border=0 cellspacing=0 cellpadding=2  width=100%  bordercolor="black">
    <tr>
      <td class="header style3">      Reply:      </td>
    </tr>
<tr>
      <td >
        <textarea name="reply_text" cols="" rows="5" class="topictext" id="reply_text" style="width: 90%;"></textarea>        <br>
      </td>
</tr>
<tr>
<td width=33% class=thinline><input name=Submit type=submit value=Submit></td>
</tr>
</table>
</form>
<? } ?>
<? mysql_close(); ?>

Link to comment
https://forums.phpfreaks.com/topic/53473-my-forum/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.