Jump to content

[SOLVED] Having some problems with sessions...


KYarb

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.

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.