Redirection if a condition is met
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Redirection if a condition is met

From: <aeldaly@gmail.com>
Date: Thu Jul 28 2005 - 05:24:12 CEST

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
Received on Mon Oct 17 21:21:20 2005