You are here: Re: [newbie] IsSet() tricky to use? « PHP Programming Language « IT news, forums, messages
Re: [newbie] IsSet() tricky to use?

Posted by Rik on 02/08/07 00:30

Vincent Delporte <justask@acme.com> wrote:

> Hello
>
> I'm learning how to use sessions to check at the top of every page
> that the user has been authenticated, but I'm having a problem with
> isset():
>
> ------------------------------------
> <?php
>
> if(!$PHPSESSID) {
> //First time: Let's check login/passwd
> //BAD $login =3D isset($_POST["login"])? $_POST["login"] : '';
> $login =3D isset($_POST["login"])? $_POST["login"] : NULL;
> $password =3D isset($_POST["password"])? $_POST["password"] :
> NULL;
>
> if(!isset($login) or !isset($password)) {

While setting a variable to NULL will indeed return false with isset(), =
=

the postfields are there. You're looking for empty() instead of isset().=

-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация