Jump to content

Sessions errors


Capnstank

Recommended Posts

Hi everyone,

 

I'm using a PHP BitTorrent tracker application on my webserver and have run into some errors. Up until yesterday the administration interface worked fine. I could log in when going to the appropriate index.php file.

 

This index.php file simply verifies that javascript is enabled on the PC, then loads a bta_jslogin.php file to handle the log in attempt. Before loading the 2nd page, it sets an attribute in the session regarding the referring page.

 

Once the bta_jslogin.php loads it immediately catches an error that the referring page is not set. Even though I haven't modified the code it is returning me to the error screen saying you need to log in from the index page (which it also links to). The link just loops you back to the error.

 

So after inspecting all this it boils down to the PHP session not being entered, or not being read properly. Can you guys look at my code snippets below and advise if there's an issue?

 

index.php line that generates the session:

$_SESSION['refering_page'] = $_SERVER['PHP_SELF'];

 

bta_jslogin.php lines handling the session check

if (!isset($_SESSION['refering_page'])) {

	admShowError("You can't access this page directly. Use bta_login.php to login to the administrative interface.",

		     "If you were NOT automatically redirected to this page ensure you have Javascript installed and functional.",

		     $adm_pageerr_title);

	exit;

} else {

	/*

	 * Let's check to see if the referring page is indeed correct

	 * This is rather redundant. I know.

	 */

	$refererArray = explode("/", $_SESSION['refering_page']);

	$refererCount = count($refererArray);



	if ($refererArray[$refererCount-1] != "index.php") {

		admShowError("You have to use admin/index.php to login to the administrative interface.",

			     "If you are trying to access this file from another page you may get this error. Use bta_login.php to login to the administrative interface.",$adm_pageerr_title);

		exit;

	}



	//reset the refering page

	$_SESSION['refering_page'] = $_SERVER['PHP_SELF'];

}

 

What the session file in my /tmp directory shows:

refering_page|s:25:"/administration/index.php";

Link to comment
https://forums.phpfreaks.com/topic/178482-sessions-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.