![]() |
Huge Session Problem
I've got a huge session problem that has me absolutely stumped ( though I'm sure the problem is the stupidest of mistakes, thats usually how PHP works ).
I am building a frontend login for my users ( no users yet, testing locally ). The login form shows up in a lightbox, user submits form. Typical. Now, I am having a problem keeping the session data. My main index pretty much runs everything. I split the url and check certain parameters and decide where the user wants to go from there. First, I use $user = $core->loadUser() to load an object with users information. If the user doesnt have a session or certain session criteria, then null values are returned. Not the problem. Next, I check if the user has info in the object. If they dont have info, I check if the login has been submitted. If not, I run my login function. I actually test the login function for true/false, and print a message depending. If true, the function sets session information... Code:
// Set some session informationNow, I think I have a problem with how I have tried to assign $user first before the login. Either way, I have never ran into this problem before. I've checked my session save folder, and the sessions surely exist. Nothing is output before calling the login or assigning user data. One thing that I think is in question that MAY be messing with things, is that further down in the index, I wrap whats to be loaded in a buffer. I get the buffer contents, which are printed in the main template file ( kinda like how Joomla operates ). The index is included after the buffer bit. Here is the index code for gathering the login, user info... Code:
// Load user objectAnyways, the rest with the buffer I spoke of just tests certain conditions to determine what to load, as I mentioned. I split the URL on $_GET['category']. It uses other core functions to load content based upon the values that exist in the URL from there. Hopefully I can find some help, this is making me go bald. :-P Thanks guys ( and girls ). |
Little update. I've gotten it working with some changes. I put session_start() at the top of the index. I also added the login and loadUser code directly in the index ( I can probably change back now ).
Seems the problem was in either ... Code:
session_name( sha1( $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'] ) );This is all just a basic setup. I want to eventually work with adding the info to database, as well as with cookies ( just found WildHoney's tutorial about sessions on Pixel2Life, great read ). |
| All times are GMT. The time now is 06:11 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0