Hello.

This is a script fragment that I am working on. It's purpose is to
validate a user by checking a database to see if the userid and password
match what has been supplied. Here it is:

if ($userid && $password)
        {
        $res = pg_exec($db, "SELECT userid FROM users WHERE
        userid='$userid' AND password='$password'");
        $x = pg_numrows($res);
        if ($x==1)
                {
                $verified_user = $userid;
                session_register ("$verified_user"); 
                Header ("Location: main.php");
                }
        }
Header ("Location: login.php")

Here is what is supposed to happen - if both $userid and $password exist,
we try to pull a record from the database ( database connection is not
shown). If the number of rows returned in 1, all is good and we register
the userid and head off the the main page. If not, we go back to the login
page.

The problem is that the user is ALWAYS re-directed back to the login page
(login.php) even when the userid and password are correct. BUT if I make
these changes, it works:

Header ("Location: main.php"); echo $userid;   <--- new line

Now, by my reasoning, the new line should't ever be executed, and if it
were, it should kick out an error. So, what is going on here?

thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to