Re: PHP Sessions?

From: Date: Wed, 02 Mar 2005 22:38:18 +0000
Subject: Re: PHP Sessions?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-209867@lists.php.net to get a copy of this message
Sorry bout that little mistake. You right I mean to check to see if $_SESSION['loggedin'] == "yes"; That doesn't make a difference as it turns out. The reason that I immediately change this is that I want the content of the page to change, and in order to do that I want to stop it from going into this code? Actually I am not going to do this, I will use another variable, but by setting $_SESSION['loggedin'] to 'no' it should not go into this test, but it somehow does? Is it to do with the link: <a href=\"index.php?action=edit\"> does this call the script again, just as an action="script.php" in a form would? Cheers for the help on this. Chris W. Parker wrote:
rory walsh <mailto:rorywalsh@ear.ie>
    on Wednesday, March 02, 2005 2:08 PM said:
Thanks everyone, I'm getting closer. The only problem I have not is that I keep entering that test, I modified it to change the session variable once we enter the test but it somehow does not seem to change it? This is the code,
Immediately I see:
if(strlen($_SESSION['loggedin']=="yes")){
That doesn't make sense. Do you mean?: if($_SESSION['loggedin'] == "yes") { And the next line:
$_SESSION['loggedin']="no";
Why are you reversing the value of 'loggedin'? Once the person is logged in shouldn't they stay that way until session timeout or they log out?
When I click the logout button it works fine, but when I click on the link inside the page it simply reloads the same page as if the session variable has not changed at all? If I link to a page like this does it call the script again, or does this need to be done with a form submit? I must apologise for my lack of knowledge here! I program in other languages and as a result I have that I can get really deep in code I don't understand very fast!
Maybe you've already stated this in a previous email and I just don't remember, what exactly is it that you're trying to accomplish? Chris.


« previous php.general (#209867) next »