I'm using Apache 1.3.27 and PHP 4.3.11 and MySQL 4.1.12
I'm following along with a text book, PHP and MySQL by Larry Ullman, and its examples. The examples were downloaded from the book's web site, so there was basically to typing on my part.
The section I'm working on is about cookies. The example home page php contains links to other pages such as login, register, and change password.
I first noticed the problem when I was studying the login.php page. Basically it's a form for entering a username and password, which it then checks against the db. When the submit is clicked, the action uses $_SERVER['PHP_SELF'] to return to the login.php page, which contains code checking the username and pw against the db. If it matches, the code sets a cookie with the user's first name, then redirects to a loggedin.php page.
That page just outputs a personalized statement of login completion using the users first name from the db.
When the login page link is again clicked, the info filled in and submit is clicked, the browser hangs for a time and then returns a 'server not found' error. If I close the browser and reopen it, it again functions as described above.
It took me a few days to determine that after the first click on submit, the $_SERVER['PHP_SELF'] returns /login.php. But the next time it returns //login.php! (I decided to echo the $_SERVER['PHP_SELF'].)
For purposes of continuing on with the book's examples, I changed the form's action= parameter to: substr($_SERVER['PHP_SELF'], 1).
This works just fine. But I'm concerned that this is a bug, and if corrected would cause the substr() to lop off the first letter of the file name in future implementations.
Has anyone run accross this before and is this in fact a bug?
I'm following along with a text book, PHP and MySQL by Larry Ullman, and its examples. The examples were downloaded from the book's web site, so there was basically to typing on my part.
The section I'm working on is about cookies. The example home page php contains links to other pages such as login, register, and change password.
I first noticed the problem when I was studying the login.php page. Basically it's a form for entering a username and password, which it then checks against the db. When the submit is clicked, the action uses $_SERVER['PHP_SELF'] to return to the login.php page, which contains code checking the username and pw against the db. If it matches, the code sets a cookie with the user's first name, then redirects to a loggedin.php page.
That page just outputs a personalized statement of login completion using the users first name from the db.
When the login page link is again clicked, the info filled in and submit is clicked, the browser hangs for a time and then returns a 'server not found' error. If I close the browser and reopen it, it again functions as described above.
It took me a few days to determine that after the first click on submit, the $_SERVER['PHP_SELF'] returns /login.php. But the next time it returns //login.php! (I decided to echo the $_SERVER['PHP_SELF'].)
For purposes of continuing on with the book's examples, I changed the form's action= parameter to: substr($_SERVER['PHP_SELF'], 1).
This works just fine. But I'm concerned that this is a bug, and if corrected would cause the substr() to lop off the first letter of the file name in future implementations.
Has anyone run accross this before and is this in fact a bug?