php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13687 Session variable not set when redirecting using full URL
Submitted: 2001-10-16 06:11 UTC Modified: 2001-10-16 10:33 UTC
From: abc at dk2net dot dk Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.0.6 OS: Win 98 and NT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: abc at dk2net dot dk
New email:
PHP Version: OS:

 

 [2001-10-16 06:11 UTC] abc at dk2net dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-16 10:33 UTC] sniper@php.net
Please ask support questions on the mailing lists:

http://www.php.net/support.php

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 20:01:34 2025 UTC