Forum Moderators: coopster
<?php
session_start();
$username = $_POST['USER'];
$passw = $_POST['PASSWORD'];
if ($username == "admin" && $passw=="pw"){
$_SESSION['SECURITY']=1;
header("Location: /phptest/admin/displayinfo.php");
}
else{
$_SESSION['SECURITY']=2;
header("Location: /phptest/admin/error.php");
}
?>
the trick is though that you can't send any output to the browser before calling session_start, a blank line is output
if you are getting some other error then it's something else ;)
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jplwebde/public_html/bowfinancial/phptest/admin/login.php:2) in /home/jplwebde/public_html/bowfinancial/phptest/admin/login.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/jplwebde/public_html/bowfinancial/phptest/admin/login.php:2) in /home/jplwebde/public_html/bowfinancial/phptest/admin/login.php on line 12
Dreamcatcher - where do you do this? --> Always set your error reporting level to E_ALL for development.
I am on a shared hosting environment. Is this something that can be set on a page or needs to be configured on the server?
Thanks
it can also be set per page using error_reporting() [php.net]