Re: Strange

From: Date: Thu, 10 May 2001 18:25:07 +0000
Subject: Re: Strange
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52402@lists.php.net to get a copy of this message
* smacks self in head * - actually, that's what I did, when I read this. thanks In article <01051022101201.00596@chrisbig>, creinig@mayn.de wrote: > 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. >

« previous php.general (#52402) next »