Bug #13687 Updated: Session variable not set when redirecting using full URL

From: Date: Tue, 16 Oct 2001 14:33:40 +0000
Subject: Bug #13687 Updated: Session variable not set when redirecting using full URL
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-68046@lists.php.net to get a copy of this message
ID: 13687 Updated by: sniper Reported By: abc@dk2net.dk Old Status: Open Status: Bogus Bug Type: Session related Operating System: Win 98 and NT PHP Version: 4.0.6 New Comment: Please ask support questions on the mailing lists: http://www.php.net/support.php Previous Comments: ------------------------------------------------------------------------ [2001-10-16 06:11:18] abc@dk2net.dk login.php checks for validity of $HTTP_POST_VARS['user'] && $HTTP_POST_VARS['pass'] and if the combination is OK sets variable $LoginSuccess which is then registered using: session_register(LoginSuccess); Conntrol is then transferred to next.php using the following code: header("Location: http://$db_host/next.php"); The value of $db_host at this stage is "localhost". When next.php starts executing it checks whether LoginSuccess is set like this: session_start(); if(empty($LoginSuccess)) ...... # Force new login The problem is that the very first time the sequence above is executed, LoginSuccess evaluates to empty even though is has been set. After a second login attemt, it usually evaluates to Set. The problem may or may not be identical to Bug ID# 6121. I found that the code works correctly if I use relative URL instead: header("Location: http:next.php"); But really, that should'nt make a difference, should it? I am using default configuration for session mgmt., everything is executed locally on my PC. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13687&edit=1

« previous php.dev (#68046) next »