Hey,
I've got a php program that someone is trying to install on their server and there's a problem we weren't above to resolve with a couple hours of troubleshooting last night...was hoping you guys might have some ideas. It seems to me like it has something to do with PHPSESSID and/or header() redirect. The problem occurs when he submits the login page. It goes to the proper place in the code on the action from the login form but as you will see below it throws and error on the header() redirect. If he refreshes his screen though he is in fine?!?! But on every login there's an error...Here's more info below!
He's running as localhost
"I have a fresh install of debian linux (stable)
2.6 kernel
apache installed
mysql installed
php installed (4.3.10)"
This is the error message that's been stumping us.
"The connection was refused when attempting to contact localhost."
We spent a couple hours trouble troubleshooting and we narrowed it down to these few lines...which was exactly the same few lines that gave me problems above. This is on login, he submits the login and then this happens.
Here's the normal code below...I believe the problem is occuring right above the header() redirect in the if block to my_team.php
if(!($rs->EOF))
{
$users_ID=$rs->fields("ID");
$leagues_ID=$rs->fields("leagues_ID");
session_start();
session_register('USERSID');
//$USERSID=$users_ID;
$_SESSION['USERSID']=$users_ID;
setcookie("LEAGUEID",$leagues_ID);
if(strlen($leagues_ID)>0)
{
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
exit();
}
else
{
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}leagues.php?PHPSESSID=$PHPSESSID");
exit();
}
}
Modified to:
session_write_close();
die("here");
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
exit();
It outputs "here" to the screen.
Modified to:
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
die("here");
exit();
It outputs "The connection was refused when attempting to contact localhost."
Modified to:
Modified to:
session_write_close();
echo "{$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID";
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
die("here");
exit();
It outputs "The connection was refused when attempting to contact localhost."
So it looks to me like the session data is not in $PHPSESSID and maybe that's what's causing the problem?
You guys have any ideas?
Also, if he refreshes his screen he is logged in and the program functions normally. Also, the action on the form that passes the login data is
action='$PHP_SELF'
Thanks!
jason
I've got a php program that someone is trying to install on their server and there's a problem we weren't above to resolve with a couple hours of troubleshooting last night...was hoping you guys might have some ideas. It seems to me like it has something to do with PHPSESSID and/or header() redirect. The problem occurs when he submits the login page. It goes to the proper place in the code on the action from the login form but as you will see below it throws and error on the header() redirect. If he refreshes his screen though he is in fine?!?! But on every login there's an error...Here's more info below!
He's running as localhost
"I have a fresh install of debian linux (stable)
2.6 kernel
apache installed
mysql installed
php installed (4.3.10)"
This is the error message that's been stumping us.
"The connection was refused when attempting to contact localhost."
We spent a couple hours trouble troubleshooting and we narrowed it down to these few lines...which was exactly the same few lines that gave me problems above. This is on login, he submits the login and then this happens.
Here's the normal code below...I believe the problem is occuring right above the header() redirect in the if block to my_team.php
if(!($rs->EOF))
{
$users_ID=$rs->fields("ID");
$leagues_ID=$rs->fields("leagues_ID");
session_start();
session_register('USERSID');
//$USERSID=$users_ID;
$_SESSION['USERSID']=$users_ID;
setcookie("LEAGUEID",$leagues_ID);
if(strlen($leagues_ID)>0)
{
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
exit();
}
else
{
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}leagues.php?PHPSESSID=$PHPSESSID");
exit();
}
}
Modified to:
session_write_close();
die("here");
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
exit();
It outputs "here" to the screen.
Modified to:
session_write_close();
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
die("here");
exit();
It outputs "The connection was refused when attempting to contact localhost."
Modified to:
Modified to:
session_write_close();
echo "{$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID";
header("Location: {$PHPFFL_WEB_ROOT}my_team.php?PHPSESSID=$PHPSESSID");
die("here");
exit();
It outputs "The connection was refused when attempting to contact localhost."
So it looks to me like the session data is not in $PHPSESSID and maybe that's what's causing the problem?
You guys have any ideas?
Also, if he refreshes his screen he is logged in and the program functions normally. Also, the action on the form that passes the login data is
action='$PHP_SELF'
Thanks!
jason