crazycoder
09-30-2006, 04:22 PM
I put together this very simple code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Feed Editor</title>
</head>
<body>
<?
$pass = 'iwonttellyerthat';
ini_set("display_errors", "1");
error_reporting(E_ALL);
?>
<? if(!isset($_SESSION['loggedin']) && !isset($_POST['pass'])) { ?>
<form action="editFeed.php" method="post">
Password: <input type="password" name="pass" size="30" />
<input type="submit" value="log in" name="submit" />
</form>
<? }
else {
if(isset($_POST['pass']) && !isset($_SESSION['loggedin'])) {
if($_POST['pass'] == $pass) {
session_start();
$_SESSION['loogedin'] = true;
}
else {
echo 'bad password!';
}
}
else {
echo 'You logged in!';
}
}
?>
</body>
</html>
I get this very strange error:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/freehost/t35.com/s/a/samoo/feed/editFeed.php:10) in /home/freehost/t35.com/s/a/samoo/feed/editFeed.php on line 26
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/freehost/t35.com/s/a/samoo/feed/editFeed.php:10) in /home/freehost/t35.com/s/a/samoo/feed/editFeed.php on line 26
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Feed Editor</title>
</head>
<body>
<?
$pass = 'iwonttellyerthat';
ini_set("display_errors", "1");
error_reporting(E_ALL);
?>
<? if(!isset($_SESSION['loggedin']) && !isset($_POST['pass'])) { ?>
<form action="editFeed.php" method="post">
Password: <input type="password" name="pass" size="30" />
<input type="submit" value="log in" name="submit" />
</form>
<? }
else {
if(isset($_POST['pass']) && !isset($_SESSION['loggedin'])) {
if($_POST['pass'] == $pass) {
session_start();
$_SESSION['loogedin'] = true;
}
else {
echo 'bad password!';
}
}
else {
echo 'You logged in!';
}
}
?>
</body>
</html>
I get this very strange error:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/freehost/t35.com/s/a/samoo/feed/editFeed.php:10) in /home/freehost/t35.com/s/a/samoo/feed/editFeed.php on line 26
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/freehost/t35.com/s/a/samoo/feed/editFeed.php:10) in /home/freehost/t35.com/s/a/samoo/feed/editFeed.php on line 26