RE: [PHP] Re: User accounts

From: Date: Thu, 07 Mar 2002 23:56:19 +0000
Subject: RE: [PHP] Re: User accounts
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87712@lists.php.net to get a copy of this message
I understand your confusion. The thing is that empty() and ! are two completely different arguments. if(empty($var)) is looking for: $var = ''; if(!$var) is looking for: $var = false; or $var = 0; If $var is set to anything other than 0 or false then the ASCII value of the string is (by definition) equivilant to an integer value of 1 or more. And thus is interpreted as true. Hope that helps. -Kevin -----Original Message----- From: David Johansen [mailto:daveisfera@yahoo.com] Sent: Thursday, March 07, 2002 3:44 PM To: php-general@lists.php.net Subject: [PHP] Re: User accounts Here's a little piece of code that gives me a weird problem: <?php if (!$logout) { if ($_SESSION['loggedin']) { unset($_SESSION['loggedin']); } } ?> I have the session started and everything, but it gives me the following error. Warning: Undefined variable: logout in c:\inetpub\wwwroot\uslogin.php on line 13 I've seen this used on several examples. I know that if I just use empty($logout) then it'll work ok, but I just wanted to know why it's used in so many examples but doesn't work in my code. Is there some setting that I have set wrong or something? Thanks, Dave "David Johansen" <daveisfera@yahoo.com> wrote in message news:20020307194743.11185.qmail@pb1.pair.com... > I'm new to this php thing and I would like to set up a web page were the > users can login and edit their preferences and all that stuff. I have the > basic login stuff worked out and I was passing the username and password as > a hidden input in the form, but then the password can be seen with view > source. I know that there's a better way to do this, so could someone point > me to a good tutorial or example on how I could make it so that the user > could login and logout and then I wouldn't need to be passing the password > all around like this. Thanks, > Dave > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#87712) next »