Jump to content

[SOLVED] Issue with determining a session value?


Twister1004

Recommended Posts

Hey everyone. I've been trying to do this for about 25 mins, so I'm a little irritable!

 

Objective: I'm making a comment thingy right now, however, now I'm adding in a feature where you can delete your own post, or if you're an admin (Level 5) you will have access to delete any post you want.

 

Issue: Any time I try to change the Power level to match "5" or grater than 4, it changes the issue with Every account that is not that level.

 

Code:

$getComments = mysql_query("SELECT * FROM `comments` WHERE `profileid` = '{$_GET['user']}' ORDER BY `commentid` DESC LIMIT 5");
			while($comments = mysql_fetch_array($getComments)){
				if($_SESSION['power'] == "5"){
					echo $comments['name'] . " says: (" . $comments['date'] . ") : <a href=\"?user={$_GET['user']}&delete={$comments['commentid']}\"> X </a><br/> " . stripslashes($comments['comment']) . "<br/>";
				}
				elseif($comments['accountid'] == $_SESSION['id']){
					echo $comments['name'] . " says: (" . $comments['date'] . ") : <a href=\"?user={$_GET['user']}&delete={$comments['commentid']}\"> X </a><br/> " . stripslashes($comments['comment']) . "<br/>";
				} 
				else { 
					echo $comments['name'] . " says: (" . $comments['date'] . ") :<br/> " . stripslashes($comments['comment']) . "<br/>";
				}
			}
			if(isset($_GET['delete'])){
				$deleteme = mysql_query("DELETE FROM `comments` WHERE `commentid` = '{$_GET['delete']}'");
				if($deleteme){
					echo "Comment Deleted";
					echo "<meta http-equiv=\"refresh\" content=\"2; url='?user={$_GET['user']}'\"/>";
				}
			}

 

If you have any questions about my post in my script, let me know =).

Did you try testing it against an int (eg. change "5" to 5 without quotes)? I don't know why it would matter, but you could try it.

 

adding echo $_SESSION['power'] in the script will allow you to be 100% sure the power level is correct before you compare it... I'm not quite sure what your problem is :)

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.