Hello people of codingforums I am having a problem with this "Cannot Modify Header Information". I know that extra blank lines can cause this problem but I just can't see where they are. They're bugging me an if you login
here, you will receive the error. I dont seem to have this error on localhost but on my website I do?
This is the error:
Quote:
|
Warning: Cannot modify header information - headers already sent by (output started at /home/connor/public_html/game/includes/top.php:11) in /home/connor/public_html/game/login.php on line 18
|
Top.php:
Code:
<?
if(session_id() == ""){ session_start(); }
?><html><head>
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<title> Cyber States - A online state simulation game.</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<meta name="robots" content="all">
<meta name="revisit-after" content="7 days">
<meta name="author" content="connor mcgarty-wood">
<meta name="keywords" content="games, gaming, cyber, states, cyberstates, simulation, simulate, online, top, 100, interesting, internet, bored, game, windows, browser game, browser">
<meta name="description" content="A online simulation game built on the topic of owning your own state. It is online
and you simulate everyday and collect taxes. This is a very interesting simulation browser games.">
</head>
<body>
<div id="header">
<img src="images/cyberstates.jpg" ALT="Cyberstates">
</div>
<center>
/* adds */
</center>
<br />
Login.php
Code:
<?
include('includes/top.php');
include('includes/menu.php');
$error="";
if(isset($_SESSION['username'])){
header('location:default.php');
}
if(isset($_POST['login'])) {
include('includes/connect.php');
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = "select * from users where username='$username' and password='$password'";
$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
$error = "Your username or password was Incorrect.";
} else {
$_SESSION['username'] = $_POST['username'];
header('Location: loggedin.php');
} }
?>
<div id="rightbox">
<H2>Login</H2>
<?
if(!$error == ""){
echo "<div class='error_message'>";
echo "$error";
echo "</div>";
}
?>
<center>
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<p> Login into the game below or register <a href="register.php" title="register here">here</a>. You need to allow cookies and javascript, some firewalls
may block cookies. </p>
<p> Username: <input name="username" id="username" title="Username" value="" size="30" maxlength="16" /><br /></p>
<p> Password: <input name="password" id="password" type="password" title="Password" value="" size="30" maxlength="24" /><br /></p>
<input type="submit" name="login" value="Login" title="Login into the Game">
</form>
</center>
<?
include('includes/bottom.php');
?>