Re: Conditions within a function
| From: | Erik Price | Date: | Tue, 16 Apr 2002 16:11:15 +0000 |
| Subject: | Re: Conditions within a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93218@lists.php.net to get a copy of this message | ||
On Tuesday, April 16, 2002, at 11:32 AM, Scott St. John wrote:
What I am also discovering is I have to use die; to halt execution for certain things. An example, I check to see if a user is still active in the system, if they are not I use a header to redirect them to a page that tells them they are inactive. if ($userActive == 0){ header ('Location: notice.php'); } As is it does not work until I do this: if ($userActive == 0){ header ('Location: notice.php'); die; }That's strange, I never have to use "die". Try using an absolute path in header(), like header('Location: http://domain.com/notice.php'), that may fix this (not sure). Also make sure that header() is executed before any HTML is output from the PHP processor, this is a common mistake for new PHP coders. Even a single line of whitespace sent before the header() line will screw it up, and this applies to all header() types, not just "Location:". Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com