You may want to change:
require('header.html');
to:
include('header.html');
Reason: Using the require command runs that page 3 times before showing it, include command inserts information once.
Try this modded code of yours:
<?
session_start();
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
include('header.html');
//if submit clicked do this
if(isset($_POST['submit'])){
$username = $_POST['username'];
$password = $_POST['password'];
//if fields empty kill script
if(!$username || !$password){
echo "Please fill out all fields."; exit(); }
if(($username == "test") && ($password == "testpass")){
//if everything checks out do this
ob_start();
$_SESSION['username@yoursite.com'] = $username;
header('Location: downloads.php');
ob_flush();
exit();
//if it fails do this
} else {
echo "Wrong info entered."; exit(); }
//if not clicked do this
} else {
echo "<form action='login.php' method='post'><p>
Username: <input type='text' name='username' size='20'><br>
Password: <input type='password' name='password' size='20'><br>
<input type='submit' name='submit' value='Log In!'></p>
</form>";
}
include('footer.html');
?>