Hi, in a php4 script I use these lines:
if(!mysql_num_rows($r))
header("Location: $SCRIPT_NAME");
In other words, if the query results in no rows at all, it must reload itself to let the user present a new chance to enter data.
In this case, it's a login script. When the user submits a name and password and it's wrong; the query results in 0 rows, and thus !mysql_num_rows($r) becomes true.
This makes a Windows NT webserver running IIS4 CRASH. Dr. Watson activates and ALL websites running on this webserver are brought down. IIS comes to a complete stop. And a message saying "STACK OVERFLOW" appears.
Is it really that stupid to use the internal PHP variable "script_name" to redirect?
When I used php4isapi.dll this worked fine. Now we are using phpts.exe in CGI mode and it crashes !!
The solution was simple, we replaced "script_name" with the actual script name so:
if(!mysql_num_rows($r))
header("Location: login.php");
This made it work perfectly again and everything run smoothly.
I'd like to know if I actually stumbled upon a real fat bug, or that I'm just plain stupid.
Greetings,
Martin.