AshleyQuick Posted July 28, 2009 Share Posted July 28, 2009 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']."?"; Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/ Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 <?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']."?"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-884626 Share on other sites More sharing options...
AshleyQuick Posted July 28, 2009 Author Share Posted July 28, 2009 Still blank Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-884646 Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 is that all of the code :confused: Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-884647 Share on other sites More sharing options...
AshleyQuick Posted July 28, 2009 Author Share Posted July 28, 2009 is that all of the code :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']); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885267 Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885271 Share on other sites More sharing options...
AshleyQuick Posted July 28, 2009 Author Share Posted July 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885290 Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 you are welcome don't forget to press topic solved Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885292 Share on other sites More sharing options...
AshleyQuick Posted July 28, 2009 Author Share Posted July 28, 2009 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']); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885325 Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 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") ?> Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885417 Share on other sites More sharing options...
darkfreaks Posted July 28, 2009 Share Posted July 28, 2009 session_register() is deprecated in PHP5 and is highly discouraged. Preferred way: <?php $_SESSION['username']='whatever'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/167746-blank-page-after-login-on-certain-web-servers/#findComment-885431 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.