Jump to content

Forum problem


dean7

Recommended Posts

hi all i have a forum for on my website but there a problem witch i carnt fix...

 

<?
session_start();
include "functions.php";
$username=$logged['username'];
include "config.php";
include"include/smile.php";
include"style.css";
?>

<?
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$level=$fetch->level;
if ($fetch->fban == "1"){

echo "<b><font color=white>You Have Been Banned From Using The Forums.";
die();
}

$forum=$_GET['forum'];

if ($forum == "Crew" && $fetch->crew != "0"){
$crew="1";

}


$forum_look=$_GET['forum_look'];
echo "<link rel=stylesheet href=includes/in.css type=text/css>";





$forum_count = 30;

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


}
if (! isset($forum_look) ) {
			$forum_look = 0;
		}
?><title><border="2"  cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">Topics</title><body bgcolor="#000000" background="backg.gif">


<p align="center"><a href="topic.php?forum=<? echo "$forum"; ?>" target="frameright"><strong>Create New Topic</strong></font> </a></font> <b><font color=white>| <a href="left.php?forum=main"><b>Refresh</a></p>
<table width="276" border="1" cellspacing="0" cellpadding="4" bordercolor="#666666" bgcolor="#000000">
  <tr><td height="29" colspan="5" background="includes/grad.gif" bordercolor=""><p align="center"><font size="2"><strong><font color="#FFFFFF" size="1">Topics
  </font></strong></font></p>
  </td>
  </tr>



<font color='white'><b><?
if ($crew == "1"){
$query="SELECT * FROM `topics` WHERE `forum`='$forum' AND crew='$fetch->crew' ORDER BY `lastreply` DESC LIMIT $forum_look, $forum_count";
}else{
$query="SELECT * FROM `topics` WHERE `forum`='$forum' ORDER BY `lastreply` DESC LIMIT $forum_look, $forum_count";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
$col="0";
while($fo=mysql_fetch_object($query)){
if ($col=="0"){ $td="#000000"; $col="1"; }else{ $td="#000000"; $col="0"; }

$hehe=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$fo->id'"));






if ($fetch->level == "member" || $fetch->level == "admin" || $fetch->level == "headmod" || $fetch->level == "mod" || strtolower($by) == strtolower($username) || $crew == "1" && $owner != "0"){
echo "<tr bgcolor=$td><td width='92%'>"; if ($fo->important == "1" ){ echo"<font color='white'><b><u>Important:</u> <a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'><b>$fo->title</b></a></font>"; } if ($fo->sticky == "1" ){ echo"<font color='white'><b>Sticky: </b></font>"; }  if ($fo->sticky == "1" ) {
echo "<a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'><b>$fo->title</b></a>  </font>"; } if ($fo->locked == "1" ){ echo"<font color='white'><b> (locked)</b></font>"; }
elseif ($fo->sticky == "1" && $fo->locked == "1") {
echo "<b>Sticky: </b></font>"; }
elseif ($fo->sticky == "0" && $fo->important == "0" ) {
echo "<a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'>$fo->title</a>  </font></td>"; }
if ($fo->locked == "1" ) {
echo "<td width=1><a title='Unlock'  href='left.php?unlock=$fo->id&forum=$forum'><font color=3399cc>[uL]</font></a></td>"; } elseif($fo->locked == "0" ) {
echo "<td width=1><a title='Lock' href='left.php?lock=$fo->id&forum=$forum'><font color=3399cc>[L]</font></a></td>"; }
if ($fo->important == "0" && $fo->sticky == "1" ) { 
echo "<td width=1><a title='Unsticky'  href='left.php?unstick=$fo->id&forum=$forum'><font color=3399cc>[uS]</font></a></td>"; }
if ($fo->important == "1" && $fo->sticky == "0" ) {
echo "<td width=1><a title='Unimportant'  href='left.php?unimportant=$fo->id&forum=$forum'><font color=3399cc>[uI]</font></a></td>"; } if ($fo->sticky == "1" ) {
echo "<td width=1><a title='Important' href='left.php?important=$fo->id&forum=$forum'><font color=3399cc>[i]</font></a></td>"; }
elseif ($fo->sticky == "0") {
echo "<td width=1><a title='Sticky'  href='left.php?stick=$fo->id&forum=$forum'><font color=3399cc>[s]</font></a></td>"; }
echo "<td width=1><a title='Delete' href='left.php?clean=$fo->id&forum=$forum'><font color=3399cc>[D]</font></a></td>";
}else{
echo "<tr  bgcolor=$td><td width='92%'>"; if ($fo->important == "1" ){ echo"<font color='white'><b><u>Important:</u> <a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'><b>$fo->title</b></a></font>"; } if ($fo->sticky == "1" ){ echo"<font color='white'><b>Sticky: </b></font>"; } 
if ($fo->sticky == "1" ){ 
echo "<a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'><b>$fo->title</b></a></font>"; } if ($fo->locked == "1" ){ echo"<font color='white'><b> (locked)</b></font></td>"; }
elseif ($fo->sticky == "0" ){ 
echo "<a href='right.php?viewtopic=$fo->id&forum=$forum' target='frameright'>$fo->title</a></td></font>"; }
}






}



if($_GET[lock]) {
$lock = $_GET[lock];
if($fetch->level == "member") { die('You cannot lock this topic'); }
$locked =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$lock'"));

$check1=mysql_query("SELECT * FROM topics WHERE id='$lock'");
$chech=mysql_fetch_object($check1);


if($level > 0 || $lock != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET locked='1' WHERE id='$lock' AND crew = '$fetch->crew' ");

}else{
mysql_query("UPDATE topics SET locked='1' WHERE id='$lock'");

}

echo "Locked";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[unlock]) {
$lock = $_GET[unlock];
if($fetch->level == "member") { die('You cannot unlock this topic'); }
$locked =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$lock'"));

$check1=mysql_query("SELECT * FROM topics WHERE id='$lock'");
$chech=mysql_fetch_object($check1);


if($level > 0 || $lock != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET locked='0' WHERE id='$lock' AND crew = '$fetch->crew' ");
mysql_query("UPDATE topics SET title='$new_tit2' WHERE id='$lock'");

}else{
mysql_query("UPDATE topics SET locked='0' WHERE id='$lock'");
}

echo "<font color=white>Unlocked";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[important]) {
if($fetch->level == "member") { die('<font coldor=white>You cannot make this topic Important'); }
$important = $_GET[important];
$check1=mysql_query("SELECT * FROM topics WHERE id='$important'");
$chech=mysql_fetch_object($check1);
$new_tit=" <b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$important'"));

if($level > 0 || $important != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET important='1' && sticky='0', lastreply='99999999999999999' WHERE id='$important' AND crew = '$fetch->crew'");
} else {
mysql_query("UPDATE topics SET important='1' && sticky='0', lastreply='99999999999999999' WHERE id='$important'");
}

echo "<font color=white>Made Important!";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[unimportant]) {
if($fetch->level == "member") { die('<font color=white>You cannot make this topic Unimportant'); }
$important = $_GET[unimportant];
$check1=mysql_query("SELECT * FROM topics WHERE id='$important'");
$chech=mysql_fetch_object($check1);
$new_tit="<b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$important'"));

if($level > 0 || $important != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET important='0', lastreply='1290232642' WHERE id='$important' AND crew = '$fetch->crew'");
} else {
mysql_query("UPDATE topics SET important='0', lastreply='1290232642' WHERE id='$important'");
}

echo "<font color=white>Made Unimportant";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[stick]) {
if($fetch->level == "member") { die('<font coldor=white>You cannot sticky this topic'); }
$stick = $_GET[stick];
$check1=mysql_query("SELECT * FROM topics WHERE id='$stick'");
$chech=mysql_fetch_object($check1);
$new_tit=" <b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$stick'"));

if($level > 0 || $stick != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET sticky='1', lastreply='999999999999999' WHERE id='$stick' AND crew = '$fetch->crew'");
} else {
mysql_query("UPDATE topics SET sticky='1', lastreply='999999999999999' WHERE id='$stick'");
}

echo "<font color=white>Stickied";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[unstick]) {
if($fetch->level == "member") { die('<font color=white>You cannot unstick this topic'); }
$stick = $_GET[unstick];
$check1=mysql_query("SELECT * FROM topics WHERE id='$stick'");
$chech=mysql_fetch_object($check1);
$new_tit="<b>$chech->title</b>";
$sticky =mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$stick'"));

if($level > 0 || $stick != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("UPDATE topics SET sticky='0', lastreply='1290232641' WHERE id='$stick' AND crew = '$fetch->crew'");
} else {
mysql_query("UPDATE topics SET sticky='0', lastreply='1290232641' WHERE id='$stick'");
}

echo "<font color=white>Unstickied";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}
if($_GET[clean]) {
if($fetch->level == "member") { die('<font color=white>You cannot delete this topic'); }
$clean = $_GET[clean];
$cc=mysql_num_rows(mysql_query("SELECT * FROM topics WHERE username='$username' AND id='$clean'"));

if($level > 0 || $clean != "0" ){
if ($forum == "Crew" && $crew == "1"){
mysql_query("DELETE FROM topics WHERE id='$clean' AND crew='$fetch->crew'");
mysql_query("DELETE FROM replys WHERE idto='$clean' AND crew='$fetch->crew'");
}else{
mysql_query("DELETE FROM topics WHERE id='$clean'");
mysql_query("DELETE FROM replys WHERE idto='$clean'");
}

echo "<font color=white>Cleaned";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL=left.php?forum=$forum'>";
}
}

?></b></font>
</table><br>


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

Sorry about the length of the code but i though it might be needed.

 

When a topic isnt sticky or locked or important it doesnt show the topic but when its sticky it shows it. If you lock the topic it just shows that the topic is locked but still doesnt show the topic. But if your a user with the level of member you can see it..

 

Carnt see why its not showing..

 

Anyone know why?

Thanks for you help.

 

Link to comment
https://forums.phpfreaks.com/topic/172324-forum-problem/
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.