Page 1 of 1

Strange occurence with Session Variables.

Posted: Thu Oct 13, 2011 8:03 am
by timcadieux
First off, the below has been working without issue for 4 years now.

I have a Login page that accepts a username and password. I execute the query and set credentials into Session variable like below, this has always worked.

Code: Select all

	if($row= mysql_fetch_array($result)){
			//Login Successful
			
			$_SESSION['SESS_ENABLED'] = 'Authenticated';
			
			session_write_close();
			header("location: index.php");
			exit();
		}else {
			//Login failed
			header("location: login-failed.php");
			exit();
		}
On my Index.php I check for Credentials, for some reason my IF statement now fails. I checked the Sessions on the Login page and the Exist.

Code: Select all

	if(!isset($_SESSION['SESS_ENABLED']) || (trim($_SESSION['SESS_ENABLED']) == '')) {   
		header("location: access-denied.php");
		exit();

	}
The only thing that I know has changed was that the Php was upgraded recently so that WordPress could be run. Ideas anyone?

Re: Strange occurence with Session Variables.

Posted: Thu Oct 13, 2011 9:38 am
by Eric!
Are you now running this login inside a WordPress template? You might try to var_dump($_SESSION) to see if WordPress is resetting your session data variables or changing your session ID.

Re: Strange occurence with Session Variables.

Posted: Thu Oct 13, 2011 9:59 am
by timcadieux
Sorry, I forgot to mention, this folder works separately from WordPress. They run in separate subfolders

Re: Strange occurence with Session Variables.

Posted: Thu Oct 13, 2011 2:43 pm
by pickle
They would still use the same php.ini file. Perhaps something has changed in that file which affects how sessions are handled. Specifically session.auto_start might have been turned off - any number of other session settings could be messing you up as well.