Connecting Tech Pros Worldwide Help | Site Map

Sessions / PHP 4.3.1

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:37 AM
NorwichLad
Guest
 
Posts: n/a
Default Sessions / PHP 4.3.1


I have a website, to which members must "log on" to gain access.

The sequence of pages is as follows:

1. index.php
Contains form for username/password

2. login.php
starts session
<?
session_start();
session_register("user_id");
session_register("logged_in");
?>
validates authentication
A - if "ok"
i. sets $user_id and $logged_id
ii. goes to membersArea_frameset.php
B - if fails - goes to an error page

This setup normally works fine, for 99% of visitors.

However, every day i get a few emails from people who receive an error
message saying that the session has expired, rather than a successful login.
Each page (including the above frameset page) has an include of
'session_check.php'.

The contents of the file is:

<?
if ($logged_in != session_id())
{
echo "<script>self.location='error.php?error=2'</script>";
exit();
}
?>

For nearly all visitors, the above setup works fine.

Any ideas why some people are told straight after successfully logging in
that their session has expired? This is really worrying. I can't figure it
out.

Have I not set up the sessions correctly?

PHP - Version: 4.3.1



  #2  
Old July 17th, 2005, 01:37 AM
Andy Fish
Guest
 
Posts: n/a
Default Re: Sessions / PHP 4.3.1

maybe their browsers do not accept cookies?


"NorwichLad" <see-signature@hill.org.uk> wrote in message
news:brdj79$28ach$1@ID-176991.news.uni-berlin.de...[color=blue]
>
> I have a website, to which members must "log on" to gain access.
>
> The sequence of pages is as follows:
>
> 1. index.php
> Contains form for username/password
>
> 2. login.php
> starts session
> <?
> session_start();
> session_register("user_id");
> session_register("logged_in");
> ?>
> validates authentication
> A - if "ok"
> i. sets $user_id and $logged_id
> ii. goes to membersArea_frameset.php
> B - if fails - goes to an error page
>
> This setup normally works fine, for 99% of visitors.
>
> However, every day i get a few emails from people who receive an error
> message saying that the session has expired, rather than a successful[/color]
login.[color=blue]
> Each page (including the above frameset page) has an include of
> 'session_check.php'.
>
> The contents of the file is:
>
> <?
> if ($logged_in != session_id())
> {
> echo "<script>self.location='error.php?error=2'</script>";
> exit();
> }
> ?>
>
> For nearly all visitors, the above setup works fine.
>
> Any ideas why some people are told straight after successfully logging in
> that their session has expired? This is really worrying. I can't figure it
> out.
>
> Have I not set up the sessions correctly?
>
> PHP - Version: 4.3.1
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.