Jump to content

Locked/Non-locked reply issue


Sinikka

Recommended Posts

I've been trying to get locked topics to non-replyable topics unless you're above a certain rank. I've managed to lock everyone out of posting on topics with the exception of people above the certain rank. I've managed to reverse that to where anyone the certain rank and above can't post period. But I can't for the life of me or sanity figure out what I'm doing wrong. This is the code I'm working with now and it's allowing everyone to post no matter if the topic is locked or non-locked.

 

 

$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

if (($subject['locked'] == "1") AND ($rank <= "14"))
{
die(header(error("view_topic.php?game=$game&id=$reply_to", "You cannot post on locked topics.")));
}

if ($subject['locked'] == "0") {
header(error("view_topic.php?game=$game&id=$reply_to&page=$page","Your message has been posted."));
}

Link to comment
Share on other sites

have you used mysql_fetch_assoc() for $subject anywhere? Looks to me you used $subject directly out of a query, and you're treating a resource as an array!

 

$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

$data = mysql_fetch_assoc($subject);

if (($data['locked'] == "1") AND ($rank <= "14"))
{
die(header(error("view_topic.php?game=$game&id=$reply_to", "You cannot post on locked topics.")));
}

if ($data['locked'] == "0") {
header(error("view_topic.php?game=$game&id=$reply_to&page=$page","Your message has been posted."));
}

Link to comment
Share on other sites

revraz, I tried your solution and got this Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/aces12/public_html/add_reply.pro.php on line 94

 

 

8ball, I tried yours and it's still letting you post on locked topics no matter what rank.

Link to comment
Share on other sites

We're trying to determine what are in your two variables.

 

echo $subject['locked'].$rank; will display whats in there so you can see why its letting you post.

 

But 8Ball is right, $subject is a Resource ID and it wont == 1

 

Link to comment
Share on other sites

Comment out the Header line and replace it with the code above I posted.

 

I'm not sure what you mean by it will display the results, the only thing the page show is "Your message has been posted." along with the topic I posted on.

Link to comment
Share on other sites

I did replace it with what you posted and it didn't show anything other then the post went through the way it normally does.

 

I even tried both versions with it and got the same results.

 

 

$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

if (($subject['locked'] == "1") AND ($rank <= "14"))
{
echo $subject['locked'].$rank;
}

if ($subject['locked'] == "0") {
echo $subject['locked'].$rank;
}

Link to comment
Share on other sites

EDIT, nevermind, need to recollect my tired thoughts... what I said doesn't work. heh

 

EDIT #2:

Ok, here's what revraz is telling you to do: we want to know what $subject and $rank contain. If you don't use a debugger, use

 

die(print_r($rank).print_r($subject));

 

Open the page, right click, goto "view source", then copy and paste the result into here.

 

This is a means to investigate the events that lead up to the problem. And likely the problem exists in one of the two.

Link to comment
Share on other sites

Thats because neither statement is true.  Since you are comparing the wrong variable, both IF statements are false.  Use ELSEIF instead, and at the end have an out:

 

$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

if (($subject['locked'] == "1") AND ($rank <= "14"))
{
echo $subject['locked'].$rank;
}

elseif ($subject['locked'] == "0") {
echo $subject['locked'].$rank;
}

else {

echo '$subject is the wrong variable to compare to';
echo $subject['locked'].$rank;

}


[quote author=Sinikka link=topic=170730.msg754943#msg754943 date=1196893986]
I did replace it with what you posted and it didn't show anything other then the post went through the way it normally does.

I even tried both versions with it and got the same results.


[code]$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

if (($subject['locked'] == "1") AND ($rank <= "14"))
{
echo $subject['locked'].$rank;
}

if ($subject['locked'] == "0") {
echo $subject['locked'].$rank;
}

[/code]
Link to comment
Share on other sites

Ok getting a tad bit confused here. I changed the code to this, I think that's what I was supposed to do from what you said.

 

$subject = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");

if (($subject['locked'] == "1") AND ($rank <= "14"))
{
die(print_r($rank).print_r($subject));

}

if ($subject['locked'] == "0") {
die(print_r($rank).print_r($subject));

}

 

 

And then I viewed the source and here's the output from that

 



<HTML>

<HEAD>

   <TITLE>Mystic Pet Quest - Forums - View Topic</TITLE>


<style><!--

    INPUT {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

TEXTAREA {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

BUTTON {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 0 solid #000000; } 

SELECT {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

INPUT {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

OPTION {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

RESET {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; } 

SUBMIT {color:#000000; font: 9pt verdana; font-weight: none; text-decoration: none; 	background: #FFFFFF; border: 1 solid #000000; }

A:link {

text-decoration:  none;

color: #002AAD;

}

A:visited {

text-decoration:  none;

color: #002AAD;

}

A:hover {

text-decoration: none;

color: #002AAD;

}

A:active {

text-decoration:  none;

color: #002AAD;

}

A:link.menu {

text-decoration:  none;

color: #FFFFFF;

}

A:visited.menu {

text-decoration:  none;

color: #FFFFFF;

}

A:hover.menu {

text-decoration:  none;

color: #FFFFFF;

}

A:active.menu {

text-decoration:  none;

color: #FFFFFF;

}

A:link.bottom {

text-decoration:  none;

color: #FFFFFF;

}

A:visited.bottom {

text-decoration:  none;

color: #FFFFFF;

}

A:hover.bottom {

text-decoration:  none;

color: #FFFFFF;

}

A:active.bottom {

text-decoration:  none;

color: #FFFFFF;

}

p

{

font-family: verdana;

font-size: 11pt;

color: black;

}

p.error

{

font-family: verdana;

font-weight: bold;

color: red;

}

p.white

{

font-family: verdana;

color: white;

}

a.white

{

color: white;

text-decoration: underline;

}

hr

{

margin: -1;

}

img

{

border: 0

}

--></style>



</HEAD>

<BODY BGCOLOR="#000000">

<CENTER><TABLE BGCOLOR="#002AAD" CELLSPACING=1 CELLPADDING=0 WIDTH="95%">

   <TR BGCOLOR="#FFCC00" width=100%>

      <TD VALIGN=bottom COLSPAN=2 HEIGHT=60 BGCOLOR="#000000" width=12>

         <P ALIGN=center><FONT SIZE="+3" COLOR="#FFFFFF"><B><a href=http://mysticpetquest.com/index.php?game=1><img src=http://mysticpetquest.com/images/user_images/opg_1/logo.gif></a></B></FONT></P>

      </TD>

   </TR>

   <TR>

      <TD VALIGN=top BGCOLOR="#000000" width=120>

         

         <a href=http://mysticpetquest.com/index.php?game=1><img src=http://mysticpetquest.com/images/nav_map.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/updates.php?game=1><img src=http://mysticpetquest.com/images/news.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/xplore.php?game=1><img src=http://mysticpetquest.com/images/explore.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/forums.php?game=1><img src=http://mysticpetquest.com/images/forums.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/auctions.php?game=1><img src=http://mysticpetquest.com/images/myauction.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/games.php?game=1><img src=http://mysticpetquest.com/images/nav_game.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/myitems.php?game=1><img src=http://mysticpetquest.com/images/nav_control.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/whoson.php?game=1><img src=http://mysticpetquest.com/images/nav_whoison.jpg width=131 height=35 border=0></a><a href=javascript:; onclick=window.open('http://mysticpetquest.com/listpets.php?game=1','listpets',config='height=425,width=300,menubar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,toolbar=no'); return false;><img src=http://mysticpetquest.com/images/nav_listvpets.jpg width=131 height=35 border=0></a><a href=javascript:; onclick=window.open('http://mysticpetquest.com/listitems.php?game=1','listitems',config='height=425,width=300,menubar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,toolbar=no'); return false;><img src=http://mysticpetquest.com/images/nav_listitems.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/stats.php?game=1><img src=http://mysticpetquest.com/images/nav_stats.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/staff.php?game=1><img src=http://mysticpetquest.com/images/nav_staff.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/login.php?game=1><img src=http://mysticpetquest.com/images/login.jpg width=131 height=35 border=0></a><a href=http://mysticpetquest.com/logout.php?game=1><img src=http://mysticpetquest.com/images/logout.jpg width=131 height=35 border=0></a>

      

      	 <P><FONT SIZE="3">

<center><font color=#3878DB><b>Username</b>:</font> <A HREF=http://mysticpetquest.com/update_profile.php?game=1 class=menu><font color=#6CABE7>Rotten To The Core</font></A><BR>
        <b><font color=#3878DB>Coppers</b>:</font> <a href=http://mysticpetquest.com/bank.php?game=1 class=menu><font color=#6CABE7>4000</font></a><BR></font></center>

      	 

      	 <form action=http://mysticpetquest.com/prompt.pro.php?game=1 method=post><p align=center><INPUT TYPE=text NAME=command VALUE="" SIZE=8><BR><INPUT TYPE=submit NAME=submit VALUE="Do it"></P></form>



      </TD>

      <TD VALIGN=top BGCOLOR="#FFFFFF" WIDTH="95%"><font color=#000000>

        <p align=center><b>Your message has been posted.</b></p> 
<SCRIPT LANGUAGE="JavaScript">
function insertSmiley(code)
{
document.reply.add_reply.value += code;
}
</script>
<p align=center><font color=#12AD2B><b>Welcome to the forums, failure to obey the rules may result in suspension of your account.<br>Remember to keep it clean, anything over PG will be deleted.</font></b></p>
<center><table><tr>
<td>
<form action=add_topic.php?game=1&add_to=4810 method=post>
<input type=submit value="Add Topic">
</form>
</td>
<td>
<form action=view.php?game=1&order=last25 method=post>
<input type=submit value="Last 25 Posts">
</form>
</td>
<td>
<form action=view.php?game=1&order=newest25 method=post>
<input type=submit value="Newest 25 Posts">
</form>
</td>
<td>
<form action=view.php?game=1&order=yourTopics method=post>
<input type=submit value="Your Topics">
</form>
</td>
<td>
<form action=search_forums.php?game=1 method=post>
<input type=submit value="Search Forums">
</form>
</td>
<td>
<form action=forums.php?game=1 method=post>
<input type=submit value="Back to forums">
</form>
</td>

</tr></table><br>
<a href=#add_reply>Add a reply to this topic!</a>
<table width=95% BGCOLOR="#BFE5EA" CELLSPACING=1 CELLPADDING=0 width=95%>
<tr bgcolor=#000000><td colspan=2><p><font color=#FFFFFF><font color=DE0029><b><i>Sending items</i> (Locked)</b></font></font></td></tr>

<tr width=100%><td width=125 valign=top bgcolor=#FFFFFF><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=kalma><font face=wingdings><FONT COLOR=#00A400><sup>¶</sup>¶<sup>¶</sup></font><font face=verdana><FONT COLOR=#9D60C0><i><b>Kalma</b></i></font></a><br><br><img src=images/user_images/opg_1/avies/premium.gif><br>  <font color=#cc66cc size=2><b>Site Manager</b></font><br>

12:32:53, Nov 8<br>Posts: 249<br><br></p><p><img src=images/icons/female.gif><a href=mail_send.php?game=1&send_to=><img src=images/icons/mail.gif></a><a href=buds.php?game=1&bud=kalma><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor=#FFFFFF><br><br><font color="#000000"><p><font color=#000000>Anytime you send an item to a friend please make sure you select the name from the drop down. If the person is not on your friend list you can use the text box below but make sure you get the name correct or the item will be sent out in to Mystic Space never to be recovered!</font></p><hr width=75% color="#002AAD"><p><center><img src="/image/rblade.jpg"></center></p></font></a></td></tr><tr bgcolor=#FFFFFF><td colspan=2><p><font color=#000000>Page: </font><a class=bottom href=http://mysticpetquest.com/view_topic.php?game=1&id=15484&page=1><font color=#000000>1</font></a></p></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=Outlaws_Dream><font face="Webdings"><FONT COLOR=#660099>&#89;</font><font face="book antiqua"><FONT COLOR=#660099><b><i>Auntie Drea</b></i><font face="Webdings">&#89;</font></font></a><br><br><img src=images/user_images/opg_1/avies/dreadagger.gif><br> <font color=#6732BA size=3><b>Site Admin</b></font><br><font size=-1>9:20:03, Nov 16</font><br>Posts: 37 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=83669#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=Outlaws_Dream><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><font color="#000000"><p><font color=#000000>A special note, this means you need to send it to the user name, not their nickname.</font></p><p><font color=#000000></font></p><p><font color=#000000>ie:  Auntie Drea = outlaws_dream</font></p><p><font color=#000000></font></p><p><font color=#000000>so if you send something to Auntie Drea, it will go into mystic outer space</font></p><hr width=75% color="#002AAD"><p><font color=purple>Purple??where???its MINE!!!</font></p></font></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=kalma><font face=wingdings><FONT COLOR=#00A400><sup>¶</sup>¶<sup>¶</sup></font><font face=verdana><FONT COLOR=#9D60C0><i><b>Kalma</b></i></font></a><br><br><img src=images/user_images/opg_1/avies/premium.gif><br> <font color=#cc66cc size=2><b>Site Manager</b></font><br><font size=-1>5:29:37, Nov 16</font><br>Posts: 249 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=83691#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=kalma><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><font color="#000000"><p><font color=#000000>Actually on this Auntie Drea is the exception. You can send items to peoples users names as well as nicknames. The only reason Auntie Drea is the exception is because if you haven't noticed, when you do your nickname it states that it has to be the same as your account name and her account is the only exception where it's different. You can try updating your nickname all you want using a name other then your account name and all it will do it default back to what your originally had it.</font></p><hr width=75% color="#002AAD"><p><center><img src="/image/rblade.jpg"></center></p></font></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:20:20, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84872#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:44:39, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84873#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:45:16, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84874#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:45:39, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84875#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:46:12, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84876#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:50:25, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84877#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr><tr bgcolor=#FFFFFF width=100%><td bcolor=#FFFFFF width=125 valign=top><font size=-1><a href=http://mysticpetquest.com/user_profile.php?game=1&user=rottentothecore>Rotten To The Core</a><br><br><img src=images/user_images/opg_1/avies/spaavatar.gif><br> <font color=#6732BA size=3><b></b></font><br><font size=-1>4:52:11, Dec 5</font><br>Posts: 133 <br><a href=view_topic.php?game=1&page=1&id=15484&quote=84878#add_reply><img src=images/icons/quote.gif height=14 width=14></a><img src=images/icons/female.gif><a href=buds.php?game=1&bud=rottentothecore><img src=images/icons/bud.gif height=14 width=14></a></p></td><td valign=top bgcolor="#FFFFFF"><br><br><p><font color=#000000>test</font></p></a></b></i></u></td></tr></table><br><CENTER><p><p><font color=#000000>Page: </font><a class=bottom href=http://mysticpetquest.com/view_topic.php?game=1&id=15484&page=1><font color=#000000>1</font></a></p><FORM NAME=reply ACTION=http://mysticpetquest.com/add_reply.pro.php?game=1&reply_to=15484&page=1 METHOD=POST>
<CENTER><TABLE BGCOLOR="#BFE5EA" CELLSPACING=1 CELLPADDING=0 WIDTH=450>
   <TR BGCOLOR="#000000">
      <TD WIDTH="100%" HEIGHT=16>
         <P><B><A NAME="add_reply"></A><font color=#FFFFFF>Add Reply:</font></B></P>
      </TD>
   </TR>
   <TR BGCOLOR="#FFFFFF">
      <TD WIDTH="100%">
         <CENTER><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
            <TR>
               <TD WIDTH=100>
                  <CENTER><TABLE BGCOLOR="#E3E3E3" CELLSPACING=0 CELLPADDING=0 WIDTH=80 HEIGHT=90>
                     <TR>
                        <TD>
                           <CENTER>
                           	<a href='javascript:;' onClick='insertSmiley(" > ");
return false;'><IMG SRC="images/smilies/spid3r/angry.gif" WIDTH=16 HEIGHT=16></a>
                           <a href='javascript:;' onClick='insertSmiley(" :-d ");
return false;'><IMG SRC="images/smilies/spid3r/bigsmile.gif" WIDTH=16 HEIGHT=16></a>
                           <a href='javascript:;' onClick='insertSmiley(" :*( ");
return false;'><IMG SRC="images/smilies/spid3r/crying.gif" WIDTH=16 HEIGHT=16></a><BR>
                           <a href='javascript:;' onClick='insertSmiley(" 0_o ");
return false;'><IMG SRC="images/smilies/spid3r/oosmilie.gif" WIDTH=16 HEIGHT=16></a>
                           <a href='javascript:;' onClick='insertSmiley(" :-p ");
return false;'><IMG SRC="images/smilies/spid3r/psmile.gif" WIDTH=16 HEIGHT=16></a>
                           <a href='javascript:;' onClick='insertSmiley("  ");
return false;'><IMG SRC="images/smilies/spid3r/sad.gif" WIDTH=16 HEIGHT=16></a><BR>
                           <a href='javascript:;' onClick='insertSmiley("  ");
return false;'><IMG SRC="images/smilies/spid3r/smilie.gif" WIDTH=16 HEIGHT=16></a>
                           <a href='javascript:;' onClick='insertSmiley("  ");
return false;'><IMG SRC="images/smilies/spid3r/wink.gif" WIDTH=16 HEIGHT=16></a>
						<a href='javascript:;' onClick='insertSmiley(" 8-) ");
return false;'><IMG SRC="images/smilies/spid3r/cool.gif" WIDTH=16 HEIGHT=16></a>
                           </CENTER>
                        </TD>
                     </TR>
                  </TABLE>
                  </CENTER>
               </TD>
               <TD>
                  <CENTER><BR>
                  <TEXTAREA NAME="add_reply" ROWS=10 COLS=40 WRAP=virtual></TEXTAREA><BR>
                  <BR>
                  </CENTER>
               </TD>
            </TR>
         </TABLE>
         </CENTER>
      </TD>
   </TR>
   <TR BGCOLOR="#E2E2E2">
      <TD WIDTH="100%" HEIGHT=30>
         <CENTER><INPUT TYPE=submit NAME=Submit VALUE="Post Message"></CENTER>
      </TD>
   </TR>
</TABLE>
<FONT SIZE="-1"><I>(You must be at least 13 to use the Mystic Pet Quest
Forums!)</I></FONT></CENTER>
</form>


      </font></TD>

   </TR>

   <TR BGCOLOR="#000000">

      <TD COLSPAN=2>

	<P align=center><FONT SIZE="-1" color="#FFFFFF"><font color=#3878DB>© 2007 MysticPetQuest.com<br>04:52:11 | <a href=http://mysticpetquest.com/tos.php?game=1 class=bottom><font color=#6CABE7>Terms/Rules</font></a> | <a href=http://mysticpetquest.com/privacy.php class=bottom><font color=#6CABE7>Privacy/Legal</font></a> | <a href=http://mysticpetquest.com/eapps.php class=bottom><font color=#6CABE7>Employment</font></a></font></FONT></P>

      </TD>

   </TR>

</TABLE>

</CENTER>

</BODY>

</HTML>

</td></tr></table> </p>  

Link to comment
Share on other sites

Sorry, we have certainly been pretty confusing. I'm going to try to simplify what's been said and add to it:

 

1. You need to have a mysql_fetch_assoc() in there. Mysql_query() returns a resource, not an array. You need to use mysql_fetch_assoc on that resource to make an array.

2. Replace your header()'s with useful error messages that will be removed when you release the final version (as suggested by revraz). This must be done to isolate the location of the problem.

3. Try to be consistent about datatype. You're being very liberal about the datatypes of these variables (is $rank less than or equal to the string "14")

 

Optional #4. Change AND to &&, this is only a minor thing, but && has stronger precedence. AND can have some odd side effects for the people who don't understand the difference between the two. It won't affect this case, just a good thing to know

 

Final combined result by revraz and myself:

 

// changed $subject to $data, and used $subject for mysql_fetch_assoc()
$data = mysql_query("SELECT * FROM forum_subjects2 WHERE game = '$game'");
$subject = mysql_fetch_assoc($data);

if (($subject['locked'] == true) && ($rank <= 14)){
die('The topic is locked');
} else if ($subject['locked'] == false) {
die('The topic is not locked');
} else {
die('There was a problem with the script');
}

 

Hopefully that'll create some results.

Link to comment
Share on other sites

Ok now I'm getting this as the output whether the topic is locked or not.

 

The topic is not locked

 

 

$rank is defined in the globals file, it pulls the rank of the person on site from 0-16 with each number being a different rank. The rank is pulled from a column in the database.

 

 

 

Edit, in the database if a topic is not locked it's status in the locked column is a 0 if it is locked it's a 1.

Link to comment
Share on other sites

Hm, ok, double check, just to make sure, that the thread you are in is locked, and whether your user has a rank higher than the user you're logged in as has a rank lower than 14. Also, perhaps you mean locked OR underranked, instead of locked AND underranked? Therefore:

 

if (($subject['locked'] == true) || ($rank <= 14)){

 

If there are still problems, the problem must reside elsewhere, and not in this immediate part of the code.

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.