[thelist] PHP / MySQL Login -- Sessions

Lachlan Cannon tiedefenderdelta6 at yahoo.com
Sun Mar 10 06:28:01 CST 2002


> Hi all.. I'm a real n00bie and all i want is to set up a
> login system using
> mySQL. My currrent problem is (since they turned down
> http-authentication on
> the server) to keep all my vars in a session.. I read
> dozens of manuals but
> i dont't get the system with sessions... someone could
> help me?

Assuming you have PHP 4 or greater:

<?php

Do your authentication stuff
set $login to either true or false
//set $username to their username if $login == true

if ($login) {
session_start();
session_register("username");
}
?>

The PHP manuals are generally good for reading about these
things. Basically, once you use session start, you can read
their session variables through the arrays $_SESSION >
4.1.0 or $HTTP_SESSION_VARS < 4.1.0 . To set a variable for
a session just use session_register and a string which is
the name of the variable you want set to their session.

HTH

Lach

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/



More information about the thelist mailing list