Sessions
From: Bruno (deadlink74_at_hotmail.com)
Date: 10/28/04
- Next message: Markus Ernst: "Re: ftp_quit($conn_id) necessary?"
- Previous message: Jeremy Ross: "Re: Build MySQL table with a query"
- Next in thread: Artur: "Re: Sessions"
- Reply: Artur: "Re: Sessions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 28 Oct 2004 12:27:46 GMT
Hi all,
I have a problem with sessions. I've got the following code in a login
script which starts up the session and registers a variable and then
redirects to the main page.
$user_id = $query_data[1]; //Pulled from a db earlier in the script
session_start();
session_register('user_id');
$_SESSION['user_id'] = $user_id;
header("Location: http://www.mydomain.com/main.php");
When the user gets to the main page it checks to see that a session is
registered (see following code) and if it isn't it throws the user back to
the login page.
session_start();
session_register("user_id");
if (empty($user_id)) header("Location: http://www.mydomain.com/login.php");
This works fine when a user opens a new browser and logs in, however, once
the session has timed out and it throws the user back to the login page it
keeps sending the user back to the login page when they try to login. This
worked fine on a server running PHP version 4.0.6 but it has been moved to a
server running 4.3.8 and it has stopped working. Any ideas?
- Next message: Markus Ernst: "Re: ftp_quit($conn_id) necessary?"
- Previous message: Jeremy Ross: "Re: Build MySQL table with a query"
- Next in thread: Artur: "Re: Sessions"
- Reply: Artur: "Re: Sessions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|