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 =).

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.