KYarb Posted March 12, 2009 Share Posted March 12, 2009 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. ??? Quote Link to comment https://forums.phpfreaks.com/topic/149095-solved-having-some-problems-with-sessions/ Share on other sites More sharing options...
Maq Posted March 12, 2009 Share Posted March 12, 2009 One equal sign is assigning, two is comparing. if ($_SESSION['username'] == $author) { Quote Link to comment https://forums.phpfreaks.com/topic/149095-solved-having-some-problems-with-sessions/#findComment-782870 Share on other sites More sharing options...
KYarb Posted March 13, 2009 Author Share Posted March 13, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/149095-solved-having-some-problems-with-sessions/#findComment-783426 Share on other sites More sharing options...
Maq Posted March 13, 2009 Share Posted March 13, 2009 I suppose I can just use strtolower to solve that problem. Yep, that should do it Quote Link to comment https://forums.phpfreaks.com/topic/149095-solved-having-some-problems-with-sessions/#findComment-783713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.