I'm talking about the line below that:
$db_name = "mydbname";
$table_name = "auth_users";
$welcome_page = header("Location: [url]http://welcome_page[/url]");
That line get's executed any time there is any username and password. So it will send the header which will redirect the browser to welcome_page no matter what password or username is sent.
The rest of the code, which is suposed to check the password against the database is now irrelevant. Since the password is checked twice in two different ways one of the checks will fail and the script will echo "no username/password found" but the header which redirects the browser was allready sent, so it dosn't matter.
Try entering different junk for username and password.
Also although $password will work instead of $_POST['password'] if register_globals = on, the latter is prefered.
Two quotes from the php.ini file that comes with php 4.3:
; Note that register_globals is going to be depracated (i.e., turned off by
; default) in the next version of PHP, because it often leads to security bugs.
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.