Murugesan,
Ok lets say you want every user to login before they can access other parts of your
site.
index.php:
<?
session_name("mysessionname");
session_start();
session_register("s_authed");
$s_authed = 0; // initialize session flag
if ((!$passwd) || (!$username)) // user hasnt logged in
{
// display login form
...
}
else
{
// retrieve database username and password here
...
// check if they match
if (($db_passwd == $passwd) && ($db_username == $username))
{
$s_authed = 1; // user has been authorised
// redirect to real page
echo "
<script>
window.location='main.php'
</script>";
}
}
?>
main.php:
<?
session_name("mysessionname");
session_start();
if (!$s_authed) // check access
{
// user hasnt been authorised, therefore redirect to login page
echo "
<script>
window.location='index.php'
</script>";
}
else
{
// display page
...
}
?>
if a user tries to access main.php directly without logging in they will be redirected
to index.php
checkout http://www.php.net/manual/en/ref.session.php for more information
> -----Original Message-----
> From: murugesan [mailto:[EMAIL PROTECTED]
> Sent: Friday, 22 August 2003 20:04
> To: Cody Phanekham; [EMAIL PROTECTED]
> Subject: Re: [PHP] How to open random Flash page with hyperlink?
>
>
> Thanks for the message.
> Can you please tell me how to do session authentication?.
>
> -murugesan
*************************************************************************************
This e-mail, including any attachments to it, may contain confidential and/or personal
information.
If you have received this e-mail in error, you must not copy, distribute, or disclose
it, use or take any action
based on the information contained within it.
Please notify the sender immediately by return e-mail of the error and then delete the
original e-mail.
The information contained within this e-mail may be solely the opinion of the sender
and may not necessarily
reflect the position, beliefs or opinions of Salmat on any issue.
This email has been swept for the presence of computer viruses known to Salmat's
anti-virus systems.
For more information, visit our website at www.salmat.com.au.
*************************************************************************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php