Jump to content

Blank page after login on certain web servers...


AshleyQuick

Recommended Posts

I cannot figure out why some server configurations are not allowing the login.  Is it an issue with the session code?  Session data is written to the "tmp" directory but that's as far as it gets.  FYI, of the servers where it's not working, none are still on php4x.  The session string does appear in the url of the blank page (not sure if that means anything).

 

index.php?PHPSESSID=31913f390774f80dcaad4b7c5a15b302PHPSESSID=31913f390774f80dcaad4b7c5a15b302

 

Here's the code:

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: text/html; charset=iso-8859-1");

@session_save_path($session_save_dir);
error_reporting(0);
clearstatcache();
session_start();

if (((bool) ini_get('session.use_trans_sid')) == FALSE)
$base_url = $_SERVER['PHP_SELF']."?".SID;
else
$base_url = $_SERVER['PHP_SELF']."?";

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: text/html; charset=iso-8859-1");

@session_save_path($session_save_dir);
error_reporting(0);
clearstatcache();
session_start();
define("SID",$_SERVER['PHPSESSID']);
if(ini_set("session.use_trans_id","on"))
$base_url = $_SERVER['PHP_SELF']."?".SID; 
else
$base_url = $_SERVER['PHP_SELF']."?";
?>

is that all of the code :confused: :confused:

 

Update:  I just noticed the url (once you click to log in) has the session string repeated:

 

index.php?PHPSESSID=8e25c6a5974d3ae3f7e3ea6c9eb99f5dPHPSESSID=8e25c6a5974d3ae3f7e3ea6c9eb99f5d

 

If you remove one in the address bar, you can successfully log in.  Any idea why this is happening?

 

Here's all the code from header.php.

 

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: text/html; charset=iso-8859-1");

@session_save_path($session_save_dir);
error_reporting(0);
clearstatcache();
session_start();

if (((bool) ini_get('session.use_trans_sid')) == FALSE)
$base_url = $_SERVER['PHP_SELF']."?".SID;
else
$base_url = $_SERVER['PHP_SELF']."?";

if (isset($_POST['input_username']) && isset($_POST['input_password'])) {
        $fd = fopen($user_file, "r");
while (!feof($fd)) {
	$userdata = explode("|", fgets($fd, 4096));
	if ($_POST['input_username'] == $userdata[0] && md5($_POST['input_password']) == $userdata[1]) {
	 	session_register('session_username');
		session_register('session_password');
		session_register('AllowCreate');
		session_register('AllowDownload');
		session_register('AllowRename');
		session_register('AllowUpload');
		session_register('AllowDelete');
		session_register('AllowView');
		session_register('AllowEdit');
		session_register('AllowAdmin');
		session_register('home_directory');
		$_SESSION['session_username'] = $_POST['input_username'];
		$_SESSION['session_password'] = md5($_POST['input_password']);
		$_SESSION['AllowCreate'] = $userdata[2];
		$_SESSION['AllowDownload'] = $userdata[3];
		$_SESSION['AllowRename'] = $userdata[4];
		$_SESSION['AllowUpload'] = $userdata[5];
		$_SESSION['AllowDelete'] = $userdata[6];
		$_SESSION['AllowView'] = $userdata[7];
		$_SESSION['AllowEdit'] = $userdata[8];
		$_SESSION['AllowAdmin'] = $userdata[9];
		$_SESSION['home_directory'] = trim($userdata[10]);
//			fclose ($fd);
		header("Location: $base_url".SID);
		break;
	}
}
fclose ($fd);
}
else if (isset($_GET['action']) && $_GET['action'] == "logout")
{
session_destroy();
header("Location: ".$_SERVER['PHP_SELF']);

}

?>

i can tell you exactly why it is repeating you have a header with .SID in it then the baseurl which has the SID in it.

 

I appreciate the help!  I removed the .SID from header("Location: $base_url".SID); and it seems to be working fine now.

I spoke too soon.  I log in successfully but once I click on any link, I'm taken back to the login page.  I don't get it.  Still using the same code:

 

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: text/html; charset=iso-8859-1");

@session_save_path($session_save_dir);
error_reporting(0);
clearstatcache();
session_start();

if (((bool) ini_get('session.use_trans_sid')) == FALSE)
$base_url = $_SERVER['PHP_SELF']."?".SID;
else
$base_url = $_SERVER['PHP_SELF']."?";

if (isset($_POST['input_username']) && isset($_POST['input_password'])) {
        $fd = fopen($user_file, "r");



while (!feof($fd)) {





$userdata = explode("|", fgets($fd, 4096));





if ($_POST['input_username'] == $userdata[0] && md5($_POST['input_password']) == $userdata[1]) {









session_register('session_username');







session_register('session_password');







session_register('AllowCreate');







session_register('AllowDownload');







session_register('AllowRename');







session_register('AllowUpload');







session_register('AllowDelete');







session_register('AllowView');







session_register('AllowEdit');







session_register('AllowAdmin');







session_register('home_directory');







$_SESSION['session_username'] = $_POST['input_username'];







$_SESSION['session_password'] = md5($_POST['input_password']);







$_SESSION['AllowCreate'] = $userdata[2];







$_SESSION['AllowDownload'] = $userdata[3];







$_SESSION['AllowRename'] = $userdata[4];







$_SESSION['AllowUpload'] = $userdata[5];







$_SESSION['AllowDelete'] = $userdata[6];







$_SESSION['AllowView'] = $userdata[7];







$_SESSION['AllowEdit'] = $userdata[8];







$_SESSION['AllowAdmin'] = $userdata[9];







$_SESSION['home_directory'] = trim($userdata[10]);
//







fclose ($fd);







header("Location: $base_url".SID);







break;





}



}



fclose ($fd);
}
else if (isset($_GET['action']) && $_GET['action'] == "logout")
{
session_destroy();
header("Location: ".$_SERVER['PHP_SELF']);

}

?>

Formatted code:

<?php
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
  header("Content-Type: text/html; charset=iso-8859-1");
  @session_save_path($session_save_dir);
  error_reporting(0);
  clearstatcache();
  session_start();
  if (((bool)ini_get('session.use_trans_sid')) == false)
      $base_url = $_SERVER['PHP_SELF'] . "?" . SID;
  else
      $base_url = $_SERVER['PHP_SELF'] . "?";
  if (isset($_POST['input_username']) && isset($_POST['input_password']))
    {
      $fd = fopen($user_file, "r");
      while (!feof($fd))
        {
          $userdata = explode("|", fgets($fd, 4096));
          if ($_POST['input_username'] == $userdata[0] && md5($_POST['input_password']) == $userdata[1])
            {
              session_register('session_username');
              session_register('session_password');
              session_register('AllowCreate');
              session_register('AllowDownload');
              session_register('AllowRename');
              session_register('AllowUpload');
              session_register('AllowDelete');
              session_register('AllowView');
              session_register('AllowEdit');
              session_register('AllowAdmin');
              session_register('home_directory');
              $_SESSION['session_username'] = $_POST['input_username'];
              $_SESSION['session_password'] = md5($_POST['input_password']);
              $_SESSION['AllowCreate'] = $userdata[2];
              $_SESSION['AllowDownload'] = $userdata[3];
              $_SESSION['AllowRename'] = $userdata[4];
              $_SESSION['AllowUpload'] = $userdata[5];
              $_SESSION['AllowDelete'] = $userdata[6];
              $_SESSION['AllowView'] = $userdata[7];
              $_SESSION['AllowEdit'] = $userdata[8];
              $_SESSION['AllowAdmin'] = $userdata[9];
              $_SESSION['home_directory'] = trim($userdata[10]);
              //
              fclose($fd);
              header("Location: $base_url" . SID);
              break;
            } //if ($_POST['input_username'] == $userdata[0] && md5($_POST['input_password']) == $userdata[1])
        } //while (!feof($fd))
      fclose($fd);
    } //if (isset($_POST['input_username']) && isset($_POST['input_password']))
  elseif (isset($_GET['action']) && $_GET['action'] == "logout")
    {
      session_destroy();
      header("Location: " . $_SERVER['PHP_SELF']);
    } //elseif (isset($_GET['action']) && $_GET['action'] == "logout")
?>

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.