Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-29-2005, 11:39 AM Session data lost
Junior Talker

Posts: 2
Trades: 0
Session data doesn't appear to be reaching a second PHP program.

The first program contains the following:
session_start();
$valid_user = $user;
echo "Registering ".$valid_user.".";
session_register("valid_user");

The second program has the following:
<?
echo "Userid=".$valid_user.".http".$HTTP_SESSION_VA RS["valid_user"].".";
// check that user is logged on
if (session_is_registered("valid_user")) {
echo "Userid: ".$valid_user;
}
else
{
echo 'Please <a href="login.php">logon</a>';
return;
}
...
?>

The output is as follows:

Registering admin.

When I click onto the link to the second program, the following output is produced:

Userid=.http.Please logon

I'd be very grateful for any help.
crossland is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-29-2005, 12:07 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Which version of PHP are you using and do you have access to the PHP.INI file? The use of http_session_vars and session_register have been deprecated in more recent releases.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-29-2005, 12:30 PM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
That's quite simple - you haven't restarted your session in the second document so the data
isn't seen.

Use
Code:
session_start();
in the very beginning of the second "program" and that should work fine. If it doesn't, let us know because as cptnwinky has written, session_is_registered and $HTTP_SESSION_VARS are depreciated...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 03-29-2005, 02:58 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Wow, I missed that all together. Good eye pitbull.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-29-2005, 03:54 PM
Junior Talker

Posts: 2
Trades: 0
Adding the session_start(); fixed it.

Thanks very much.
crossland is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Session data lost
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15441 seconds with 12 queries