Seems confusing.

-------------------------
//include.php
session_name("sessionname");
session_start();
-------------------------->>
This was added in a separate file and included that file in all the files
including index.php
In index.php I registered a variable s_authed and initialised it to 0

-----------------------------
//index.php
include "include.php";
session_register("s_authed");
$s_authed = 0; // initialize session flag
----------------------------->>

And after sign up I am authenticating the user in a separate file
and setting a flag s_authed to 1
-----------------------------
//auth.php
if(check for authentication)
{
   ........
   $HTTP_SESSION_VARS['s_authed']=1;
}
----------------------------->>
Now in the main.php
I am checking
-----------------------------
//main.php

if($s_authed==1)
{
   //Display login form code goes here
}
else
{
    display "authentication required";
}
----------------------------->>



This is working fine. Even when I copy and paste the URL to another browser
it is showing authentication required page.
When I used

if (!isset($_SESSION['sessionname']))
{
   //Display login form code goes here
}

in main.php
it is not working. I mean that it display the page even when I copy and
paste URL in a new browser window.

Seems like an essay :)
Why is it so.
Is that my previous method was correct or any mistakes I did?



-murugesan






----- Original Message -----
From: "Paul Fitzpatrick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 10:43 PM
Subject: RE: [PHP] Session problem in back button


>
> Hi,
>
> This will stop them seeing the login once they are in a registered
> session
> Only diplay the login form if NOT a registered session variable
> 'sessionname' (or some other session variable)
>
>
> If (!isset($_SESSION['sessionname']))
> {
>    //Display login form code goes here
> }
>
> Cheers.
>
>
>
>
> -----Original Message-----
> From: murugesan [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 9:55 AM
> To: murugesan; Cody Phanekham; [EMAIL PROTECTED]
> Subject: [PHP] Session problem in back button
>
> Hello all,
>         Now i have a problem in back button.
>         After signing in when I click back button It goes to login page.
> But
> when I click the forward button it is going to the main page.
> How can I prevent this.
>
> -murugesan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to