Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-28-2012, 04:45 AM   PM User | #1
connormcwood
New Coder

 
Join Date: Sep 2011
Location: Blackpool
Posts: 31
Thanks: 6
Thanked 1 Time in 1 Post
connormcwood has a little shameless behaviour in the past
modify header

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'); 
?>
__________________
Google was late to search. Facebook was late to social networking. Apple was late to the MP3 player. It's never too late. Just do it better
My website: http://www.connormcwood.com/forum/
connormcwood is offline   Reply With Quote
Old 08-28-2012, 05:34 AM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
You cannot send anything before modifying header information. This includes most of the content of top.php

Either move header() much earlier in the code-order, or investigate output buffering:
ob_start() and ob_end_flush().

..and the center tag is defunct?!
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 08-28-2012 at 05:37 AM..
AndrewGSW is offline   Reply With Quote
Old 08-28-2012, 08:27 PM   PM User | #3
connormcwood
New Coder

 
Join Date: Sep 2011
Location: Blackpool
Posts: 31
Thanks: 6
Thanked 1 Time in 1 Post
connormcwood has a little shameless behaviour in the past
Grrr the error wont go away:/
__________________
Google was late to search. Facebook was late to social networking. Apple was late to the MP3 player. It's never too late. Just do it better
My website: http://www.connormcwood.com/forum/
connormcwood is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:31 PM.


Advertisement
Log in to turn off these ads.