Add an exit(); immediately following all the header() calls. Hitting a
header() does not end execution of the script, so without the exit() the
last header() that gets called is the one that actually occurs.
Kirk
> -----Original Message-----
> From: Chad Day [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 17, 2001 9:13 AM
> To: Php-General@Lists. Php. Net
> Subject: [PHP] help with header/cookies ..
>
>
> I'm submitting a form to a search page that performs
> different searches
> based on what engine was selected. One of these searches is
> restricted, and
> runs a function that checks for a cookie. If the user has no
> cookie, they
> are redirected to a login page.
>
> I've used echo tests to make sure the function is being run
> correctly, that
> I don't have a cookie, etc, and it all checks out. I
> *SHOULD* be redirected
> to a login page, but I am not.
>
>
> if ($fromwhere == "ARCHIVES") {
> check_cookie($cookiename);
> Header("Location: gotosearch);
> }
>
> switch ($fromwhere) {
> case "SITE":
> Header("Location: gotosearch2);
> break;
> case "ARCHIVES":
> check_cookie($cookiename);
> Header("Location: gotosearch3);
> break;
> }
>
>
> I tried putting the check_cookie statement in and outside of
> the switch
> statement, but both places perform the cookie check, fail it,
> but don't
> redirect me, and continue to allow me to search? What is
> wrong with my
> code? Is there something I'm missing about how I'm handling my
> headers/cookies? I have the check_cookie function working on
> several other
> parts of the site, but for some reason I can't get this to work .. :(
>
> Thanks,
> Chad
>
>
> --
> 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]
>
--
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]