Re: Redirection if a condition is met
- From: "chotiwallah" <chotiwallah@xxxxxx>
- Date: 28 Jul 2005 01:14:40 -0700
aeldaly@xxxxxxxxx wrote:
> I know this topic has been discussed a few times here and also on
> php.net, but I cannot find an answer to my specific problem. I check to
> see if a user is logged in before serving admin.php like so:
> <?php
> session_start();
> if (!isset($_SERVER['username']) or !isset($_SERVER['password'])) {
> header("location:http://linux-place.com");
> exit;
> }
> ?>
> These are the very first lines in the file. It works perfectly. The
> problem is that I would like to output a message like "Please login
> first before accessing the administration panel". How can I do that
> without getting the headers already sent error?
>
> Thanks,
> Ahmed El-Daly
i generally use a 3 step procedure:
1. check if headers are sent, if not use header to redirect
2. if headers are sent already, print a javascript relocation routine
3. as a fallback if javascript is disabled, print a normal link
micha
.
- References:
- Redirection if a condition is met
- From: aeldaly
- Redirection if a condition is met
- Prev by Date: Re: Show countdown from 10 to 0 seconds
- Next by Date: Re: How to kill process started by user?
- Previous by thread: Redirection if a condition is met
- Next by thread: Re: Redirection if a condition is met
- Index(es):
Relevant Pages
|