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]
|