[PHP-DEV] Bug #10930: Can't connect to mysql after running some code that crashes IIS 5 From: tyler.longren <email protected>
Date: 05/17/01

From: tyler.longren <email protected>
Operating system: Windows 2000
PHP version: 4.0.5
PHP Bug Type: MySQL related
Bug description: Can't connect to mysql after running some code that crashes IIS 5

After running the code below, PHP 4.0.5 is no longer able to connecto to mysql. I have tested this at 2 different locations, and the result is the same every time. Also after visiting the website with this code in it, inetinfo.exe (IIS) crashes.

PHP was installed with php405-installer.exe. The problem occurs on Windows 2000 Professional SP1 & SP2. Windows 2000 server has not been tested. Below is the code that should be pasted into a webpage, and then visited with any browser. I accidentally caused inetinfo.exe to die with this:

<?
/*
This was written (accidentally) by Tyler Longren <tyler.longren <email protected>>.
This was found on accident...thanks to my crappy coding. :)
Date: 05-14-2001
Kills: Inetinfo.exe on Win2k
*/
session_start();
session_register('username');
session_register('password');
header("Location: $PHP_SELF");
if ($formusername) {
        mysql_connect("$mysql_host","$mysql_user","$mysql_pass");
        mysql_select_db("$mysql_db");
        $auth_sql = mysql_query("SELECT * FROM $mysql_user_table WHERE username =
'$formusername' AND password = '$formpassword'");
        $user_exists = mysql_num_rows($auth_sql);
        if ($user_exists == "1") {
                $username = $formusername;
                $password = $formpassword;

        }
        else {
                $login_error = "<font face=Arial size=2><b>Error:</b></font><br><font
face=Arial size=1>Wrong<br>username/password</b></font>";
                session_unregister('username');
                session_unregister('password');
        }

}
else {
        mysql_connect("$mysql_host","$mysql_user","$mysql_pass");
        mysql_select_db("$mysql_db");
        $auth_sql = mysql_query("SELECT * FROM $mysql_user_table WHERE username =
'$username' AND password = '$password'");
        $user_exists = mysql_num_rows($auth_sql);
        if ($user_exists == "1") {
                // blah blah blah!
        }
        else {
                $login_error = "<font face=Arial size=2><b>Error:</b></font><br><font
face=Arial size=1><b>Wrong<Br>username/password</b></font>";
                session_unregister('username');
                session_unregister('password');
        }
}
if ($login == "no") {
        session_destroy();
        session_unregister('username');
        session_unregister('password');
        header("Location: $PHP_SELF");
}
?>

-- 
Edit Bug report at: http://bugs.php.net/?id=10930&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>