Jump to content

Still Show Topic If Its Locked..


Steven8294

Recommended Posts

Hello, I have a forum and i want to still show the topic even though its locked. I know its something to do where the --------- is i think any help would be very usefull thanks.

 

 

 

if ($lockedornot == '1'){

echo "---------" ;

}elseif ($userlevel != '0' || $lockedornot != '1'){

Link to comment
Share on other sites

Please don't bump your topic here within short intervals. You're not the most important person here and even if you are, you should respect others. Continually bumping it like that would result in your topic being closed or deleted. Not sure how the mods would handle it, but it's not good.

 

And you didn't provide any relevant information for us to help you.

Link to comment
Share on other sites

<?
session_start();
include "includes/db_connect.php"; 
include "includes/functions.php";
include"includes/smile.php";
logincheck();
$forum=$_GET['forum'];
$username=$_SESSION['username'];
$viewtopic = $_GET['viewtopic'];
$forum_look=$_GET['forum_look'];


if (!$viewtopic){
$viewtopic = "1";
}
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users 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'){
;
}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];

}




?>
<table width=100% border=1 cellspacing=0 cellpadding=2  class=thinline bordercolor=black><tr><td  background=includes/grad.jpg align=left><center class=TableHeading>Topic Made By : <? echo "<a href='profile.php?viewuser=$username1' target=middle>$username1</a>"; ?> On :<?php echo "$made"; ?></center></td></tr>

<tr><td>

<? echo replace($topictext); 
if ($topictext == ""){ $topictext = "Main Forum";}?>


</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 href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
	print " <a 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"){


echo "<table width=100% cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black><tr><td background=includes/grad.jpg><a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <b>On:</b> $right->made</td></tr>

<tr> <td>";

echo replace($right->text);


echo "</td></tr></table><br>
<p>";
}elseif ($userlevel == 0){
echo "<table width=100% cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black><tr><td background=includes/grad.jpg><a href='profile.php?viewuser=$right->username'>$right->username</a> <b>On:</b> $right->made</td></tr>
<tr><td bgcolor=black height=1></td></tr>
<tr><td>";

echo replace($right->text);


echo "</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 "$topic";
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());
}else{
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'");
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"; ?>">

  <table class=thinline border=1 cellspacing=0 cellpadding=2  width=100%  bordercolor="black">
    <tr>
<td background="includes/grad.jpg"><center><font color=#FFFFFF>Reply:</font></center></td>
</tr>
<tr>
      <td ><center> <div align="center">
          <textarea name="reply_text" cols="" rows="5" id="reply_text" style="width: 90%;"></textarea>
          <br>
        </div></td>
</tr>
<tr>
<td width=33% class=thinline><center><input type=submit value=Submit name=Submit></td>
</tr>
</table>
</form>
<? } ?>

Link to comment
Share on other sites

Just a fling here. Don't know if it works. Try this:

 

<?
session_start();
include "includes/db_connect.php"; 
include "includes/functions.php";
include"includes/smile.php";
logincheck();
$forum=$_GET['forum'];
$username=$_SESSION['username'];
$viewtopic = $_GET['viewtopic'];
$forum_look=$_GET['forum_look'];


if (!$viewtopic){
$viewtopic = "1";
}
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users 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)){
$stikornot = $dsdsd[1];
$lastreplyit = $dsdsd[2];
}

if ($userlevel != '0'){

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];

}




?>
<table width=100% border=1 cellspacing=0 cellpadding=2  class=thinline bordercolor=black><tr><td  background=includes/grad.jpg align=left><center class=TableHeading>Topic Made By : <? echo "<a href='profile.php?viewuser=$username1' target=middle>$username1</a>"; ?> On :<?php echo "$made"; ?></center></td></tr>

<tr><td>

<? echo replace($topictext); 
if ($topictext == ""){ $topictext = "Main Forum";}?>


</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 href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
	print " <a 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"){


echo "<table width=100% cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black><tr><td background=includes/grad.jpg><a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <b>On:</b> $right->made</td></tr>

<tr> <td>";

echo replace($right->text);


echo "</td></tr></table><br>
<p>";
}elseif ($userlevel == 0){
echo "<table width=100% cellspacing=0 cellpadding=2 border=1 class=thinline bordercolor=black><tr><td background=includes/grad.jpg><a href='profile.php?viewuser=$right->username'>$right->username</a> <b>On:</b> $right->made</td></tr>
<tr><td bgcolor=black height=1></td></tr>
<tr><td>";

echo replace($right->text);


echo "</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 "$topic";
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());
}else{
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'");
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"; ?>">

  <table class=thinline border=1 cellspacing=0 cellpadding=2  width=100%  bordercolor="black">
    <tr>
<td background="includes/grad.jpg"><center><font color=#FFFFFF>Reply:</font></center></td>
</tr>
<tr>
      <td ><center> <div align="center">
          <textarea name="reply_text" cols="" rows="5" id="reply_text" style="width: 90%;"></textarea>
          <br>
        </div></td>
</tr>
<tr>
<td width=33% class=thinline><center><input type=submit value=Submit name=Submit></td>
</tr>
</table>
</form>
<? } ?>

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.