Welcome Guest, Not a member yet? Register   Sign In
if(!$_SESSION['username']) ?
#4

[eluser]tpetrone[/eluser]
not true what?

How about in layman word?

If username is not in session?

if(!$_SESSION['username']) in layman's terms.. if the array $_SESSION has a key called "username" and it's not set. But more specifically this it will act like a Boolean TRUE/FALSE.. So if $_SESSION['username'] is "FALSE" - identified by the "!" then run the autolgin.php .

or
If username does not exist in session?

That is another way to read it but the behavior of the execution is not what you would expect.

Cleaner way of doing this so that it reads a bit better.

again not knowing what the username should be set too.

Code:
if(isset($_SESSION['username']) && $_SESSION['username'] === TRUE )
{
  //.. Do something here...//

}else{

   include_once 'autologin.php';

}


Since you didn't post the full source not sure what you are attempting to achieve.

Hope this helps.


Messages In This Thread
if(!$_SESSION['username']) ? - by El Forum - 11-12-2012, 06:57 PM
if(!$_SESSION['username']) ? - by El Forum - 11-12-2012, 07:04 PM
if(!$_SESSION['username']) ? - by El Forum - 11-12-2012, 07:13 PM
if(!$_SESSION['username']) ? - by El Forum - 11-12-2012, 07:35 PM
if(!$_SESSION['username']) ? - by El Forum - 11-13-2012, 12:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB