On Wednesday 09 May 2001 19:32, paket wrote:
> 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")
> 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
Sure. if $x == 1 you output the Location: main.php, followed by
Location:login.php
Place an exit () after the header calls.
> 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?
header () just adds a line to the HTTP headers. you can call it as often
as you want.
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Install once, run forever. Linux.
--
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]