0

Hello All! This is my first post, as I just joined this forum after finding lots of information about my problem, but no actual solutions...

Same basic issue as most, but I've tried everything, and nothing is working!

1. User Logs in - upon authentication, user is taken to "member's homepage."
- This works, session information is correct, session file has correct info.
2. User clicks "HOME" to goto homepage of website.
- YES, there is a session_start(); declaration at the top of the page, no whitespace after PHP open tag.
3. New session file is created, previous page data not recognized.

Basically, if you visit other pages (even those not in the member's area) there is a check to see if the user login session is valid, and if so, display user information rather than login information on those pages. I just can't get it to work. Any ideas?

The index.php page has no additional PHP, just the start_session(); stuff and the session check.

Any advice?

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by ballchain
0

If the flow of control moves between modules using forms and as a result of the action parameter on the <form statement, then there should be no problem retaining session data as long as every module has a session_start. If you are using a header statement to re-direct the flow of control, then the original session may be lost at that point. If you are doing a re-direct and want to retain the same session, then you will need to pass the session ID and re-establish that session after the re-direct.

header("Location: newpage.php?phpSESSID=".sessionĀ­_id());

// Then in new page the code looks like this 
<?php 
session_id($_GET['phpSESSID']); 
session_start();

Edited by chrishea: n/a

0

For some reason, I uploaded my test files to an online host, and it works, but not on my development machine. Is there a setting in PHP that controls this?

Passing the session_id through the URL is probably how I'll have to go for now until I can figure it out. I just can't explain why it won't work here, but works on a cheap web host?!?

0

You can check the php ini parameter session.cookie_lifetime. It is normally set to 0 to make the session last until the browser is closed.

0

You can check the php ini parameter session.cookie_lifetime. It is normally set to 0 to make the session last until the browser is closed.

It's set to 0. The PHP.ini was one of the first things I went through.

It seems to be an issue when switching folders. All files in the members folder aren't affected, but anything outside of that folder doesn't recognize the sesssion info.

I've gone as far as setting VHOSTS in both Apache and Windows to 'spoof' a base directory and base url in hopes that it would solve it.

Thanks for the reply though, it's surely some little thing like that I've just forgot.

0

kindly mark solved thread as solved

When it's solved, I'll mark it as such. I still have the problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.