Re: Sessions help please
| From: | Hardy Merrill | Date: | Wed, 21 Mar 2001 13:46:30 +0000 |
| Subject: | Re: Sessions help please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44945@lists.php.net to get a copy of this message | ||
KPortsmout@aol.com [KPortsmout@aol.com] wrote:
> Hi,
>
> I am going to use sessions to authenticate and protect my pages, this is what
> I have so far...
>
> User logs in via form, this is checked via a SQL call, if the correct
> username and password are entered I run the following:
>
> session_start();
> session_register("UserName","Password");
You have to register each "field" like this:
session_register("UserName"); // register UserName as a session var
$UserName = $new_value_for_username; // give UserName session var a
new value.
session_register("Password"); // register Password as a session var
$Password = $new_value_of_password; // give Password session var a
new value.
Then in the next script, after you do session_start();, you
will have access to those previously registered session
variables by just using $UserName and $Password.
HTH.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com
> header ("Location: Http://www.domain.com/members/index.php");
>
> The bit where I get lost is 1) how to authenticate this on each page and 2)
> How to close the session after the browser has closed. I have tried many
> tutorials etc but none seem to go into great detail in those areas. Anyone
> know of any decent tutorials or any snippets I can learn from.
>
> Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net