HELP W/ PHP Session Login App

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi Guys,
Please HELP! I'm new to PHP and would like to get your professional

I"m writing simple and small login app using php session variable. I
have 3 php scripts. The first is just a simple php form, login.php,
that passes the variables to auth.php.

Auth.php just validates that the username and password is correct. If
they match, i will set the php session,

$_SESSION['logon'] = "ok", then redirect the user to anothor page,


if ($_SESSION['login'] != "ok")
header("Location: login.php");
/* do some stuff 8/

My code works well on the login.php and auth.php. But for some reason,
when I get to ADMIN.PHP, it says that they it has an "UNDEFINED INDEX,

Can anyone help me or have a sample php program that uses sessions for
Much Help would be appreciated.

Thanks in advance,

Re: HELP W/ PHP Session Login App

Quoted text here. Click to load it

If you give us professional pay :p

Quoted text here. Click to load it

Quoted text here. Click to load it

Notice that login != logon.

But before you check the value in the 'login'/'logon' key of the array,
you might want to use to make sure
there is such a key (and value).

if (!array_key_exists('logon', $_SESSION) || $_SESSION['logon'] != 'ok')
    // don't know how well browsers support redirection with a relative
    // uri -
    header("Location: login.php");

Met vriendelijke groeten,
Tim Van Wassenhove <

Re: HELP W/ PHP Session Login App

Better if u can improve ur login script.
problem is if the connected user keep the browser after logout without
closing we can go to the other pages from ur auth.php. bec IE will
supply the supplied passwo and username. use some query string in auth
page relating with session ID and check it in the auth page. and after
logout regenerate new session id. so if another user back, he can`t
relate new sessionid with previous query string.

Re: HELP W/ PHP Session Login App says...
Quoted text here. Click to load it

I have a compact login package available a
(I can zip it if you need that, RAR can read as-is).

At present it uses MySQL to produce the first auth and stores its state

Modify it if you want.

Treehouse Networks abuse@

Site Timeline