Cant modify header information
Posted: Mon Jan 24, 2005 7:04 pm
I've been working on a login script which follows:
The error I keep getting is:
I've checked php.net docs, and codewalkers, and everywhere else I could think of, and now I'm looking for another human brain to take a peek at it, cuz its driving me bonkers.
Things I've tryed include putting the session_start() at the very top, session_cache_limiter(), and other various header() commands to attempt to prevent the default headders.
Code: Select all
<?
$db = mysql_connect("host", "login", "pass") or die('Could not connect: ' . mysql_error());
mysql_select_db("database") or die("Could not select database");
$query = "SELECT * FROM userbase where Uname = '$_POSTїuname]' AND pword = '$_POSTїpword]'";
$result = mysql_query($query);
if (mysql_fetch_row($result))
{
echo "access granted";
mysql_free_result($result) or die('Cant free it');
mysql_close($db) or die('Cant close it');
session_start();
header("Cache-control: private");
$_SESSIONї"access"] = "granted";
header("Location: http://www.domain.com/secure.php");
exit;
}else{
echo "access denied";
header("Location: /index.html");
exit;
}
?>Code: Select all
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /srv/www/htdocs/checkpw.php:2) in /srv/www/htdocs/checkpw.php on line 13
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /srv/www/htdocs/checkpw.php:2) in /srv/www/htdocs/checkpw.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/checkpw.php:2) in /srv/www/htdocs/checkpw.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/checkpw.php:2) in /srv/www/htdocs/checkpw.php on line 16Things I've tryed include putting the session_start() at the very top, session_cache_limiter(), and other various header() commands to attempt to prevent the default headders.