ID: 14636 Comment by: mgandalf at seznam dot cz Reported By: kannan at tmsassociates dot com Status: Bogus Bug Type: Session related Operating System: windows 2000 professional PHP Version: 4.0.6 New Comment:
Hi, I just look at your source and php.ini and it was clear to me. Problem is here: "session.cookie_path = c:\temp". It is not path to file but path on web server where is cookie valid. So change it to "session.cookie_path = /" and it will work. When it is for example "/dir_name", cookie is valid just for http://server/dir_name/, but not for http://server/dir_name2/ and in this 2nd case will not be sent. Gandalf Previous Comments: ------------------------------------------------------------------------ [2004-01-09 17:47:15] writeto_ben at hotmail dot com I would have liked a simple header redirect as well, but unfortunately the other suggestions didn't solve the issue. However, setting a javascript redirect seemed to do the trick. I'm using Win2k professional, IIS 5.0, PHP Version 4.3.4 This will work on IE browsers. Just modify the javascript for netscape compatibility. <? //...perform login check, produce $errStr if fails if($errStr){ header("Location: login.php?err=".$errStr); }else{ print '<html> <body onload=eval("window.location.href=\'http://blahblahblah/default.php\';");></body> </html>'; } ?> ------------------------------------------------------------------------ [2003-12-05 23:28:10] venki_cute123 at rediffmail dot com i have a session variable to be accessed in same page but submit twice in same page at third time I am not able to access session variable ------------------------------------------------------------------------ [2003-11-22 18:18:19] andrew dot whale at which dot net Hi I've also had a similar problem of session variables not being passed following a call to header(). I am running PHP 4.0.15 on an XP m/c. The following worked for me, by placing a session_write_close() before the call to header, followed by and exit(): session_write_close(); header("Location: $strPage"); exit(); I hope this will be of use to some. Andrew Whale ------------------------------------------------------------------------ [2002-02-07 21:23:36] [EMAIL PROTECTED] This issue will not be able to be fixed by PHP. Some browser does not set cookie for initial request. To make sure cookie is enabled _always_, user must check it first. http://www.zend.com/search_code_author.php?author=yohgaki Use session helper html or other people post without JavaScript version. ------------------------------------------------------------------------ [2002-02-07 05:25:24] betsos at westgate dot gr I have experienced a similar problem with Kannan but not due to session.auto_start. In my php.ini session.auto_start is set to 0. I use the following scripts. When run, either with PHP Version 4.0.6, or with Version 4.1.1 and IIS under NT 4.0, the second script - test_login.php - starts a new session and variable $username is unset. When run with PHP 4.0.1 and Apache under Unix they work just fine. // ------ login.php ------ <?php session_start(); session_register("username"); $username = "justme"; Header("Location: ./test_login.php"); ?> // ------ test_login.php ------ <?php session_start(); if ( isset ($username) ) echo $username; else echo "Not authenticated!"; ?> // ----------------------- According to Chris 'This is actually not a bug at all but rather behavior of HTTP'. If this is the case then how comes that I don't have this problem when I use PHP Version 4.0.1 with Apache? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/14636 -- Edit this bug report at http://bugs.php.net/?id=14636&edit=1