Jump to content

Recommended Posts

I'm having some problems with sessions, I have a little membership script running with users stored in the database and all. Then I have another page, and on this page I have a if statement that says:

 

<?php
if ($_SESSION['username'] = $author) {
?>
<tr><td class="blank"></td></tr>
<tr><td><b>:: Author Options</b></td></tr>
<tr><td><a href="?id=remove&dl=<?php echo $id; ?>">Remove Project</a></td></tr>
<tr><td><a href="?id=update&dl=<?php echo $id; ?>">Update Project</a></td></tr>
<?php
}
?> 

 

Now, when anyone visits this page... their $_SESSION['username'] is changed to $author.  ???

One equal sign is assigning, two is comparing.

 

if ($_SESSION['username'] == $author) {

 

Oh. My. God. After all that frustration I missed an equal sign. =.=;

 

Thank you, Maq. I feel like an idiot. :)

 

It would also seem that there's a conflict in capitalization, as the session/membership makes all usernames lowercase, whereas the $author variable had capital letters. I suppose I can just use strtolower to solve that problem.

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.