I apologise in advance i know this has been done to death but i cant find an answer.

im currently getting this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/test.com/public_html/index.php:9) in /home/sites/test.com/public_html/login.php on line 5

my index file is as so:

<?php
session_start(); 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<LINK REL="SHORTCUT ICON" HREF="images/cuju8.ico" type="image/x-icon"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title>英超联赛,英超积分榜,英超赛程表,英超新闻 - 蹴鞠吧</title>
<link href="default.css" rel="stylesheet" type="text/css" media="screen" >
		<?php include("menu.php");?>
			<div id="wrapper">
			<div id="page">
				<?php include("side.php");?>
		<!-- start content -->
		<div id="content">
			
			<div class="post">
				<div class="entry">
<SCRIPT LANGUAGE="JavaScript">
//-- Begin Scroller's Parameters and message -->
//scroller width: change to your own;
var wwidth=470;

//scroller height: change to your own;
var wheight=20;

//background color: change to your own; 
var wbcolor="white";

//scroller's speed: change to your own;
var sspeed=2;
var restart=sspeed;
var rspeed=sspeed;

//text: change to your own

wwholemessage='<nobr class=tab><b><a href="http://www.cuju8.com/CompetitionWinners.php">上周蹴鞠吧英超互动短信竞赛获奖名单及奖品详细内容。 '+
''+
'</b></nobr>';



//-- begin: Scroller's Algorithm -->
var sizeupw=0;var operbr=navigator.userAgent.toLowerCase().indexOf('opera');if(operbr==-1&&navigator.product&&navigator.product=="Gecko"){var agt = navigator.userAgent.toLowerCase();var rvStart = agt.indexOf('rv:');var rvEnd = agt.indexOf(')', rvStart);var check15 = agt.substring(rvStart+3, rvEnd);if(parseFloat(check15)>=1.8) operbr=0;}if (navigator.appVersion.indexOf("Mac")!=-1)operbr=0;
function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}
function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}
function startw(){if(document.getElementById)ns6marqueew(document.getElementById('wslider'));else if(document.all) iemarqueew(wslider);else if(document.layers)ns4marqueew(document.wslider1.document.wslider2);}function iemarqueew(whichdiv){iedivw=eval(whichdiv);iedivw.style.pixelLeft=wwidth+"px";iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=iedivw.offsetWidth;ieslidew();}function ieslidew(){if(iedivw.style.pixelLeft>=sizeupw*(-1)){iedivw.style.pixelLeft-=sspeed+"px";setTimeout("ieslidew()",100);}else{iedivw.style.pixelLeft=wwidth+"px";ieslidew();}}function ns4marqueew(whichlayer){ns4layerw=eval(whichlayer);ns4layerw.left=wwidth;ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>');ns4layerw.document.close();sizeupw=ns4layerw.document.width;ns4slidew();}function ns4slidew(){if(ns4layerw.left>=sizeupw*(-1)){ns4layerw.left-=sspeed;setTimeout("ns4slidew()",100);}else{ns4layerw.left=wwidth;ns4slidew();}}function ns6marqueew(whichdiv){ns6divw=eval(whichdiv);ns6divw.style.left=wwidth+"px";ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=ns6divw.offsetWidth;if(operbr!=-1){document.getElementById('operaslider').innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=document.getElementById('operaslider').offsetWidth;}ns6slidew();}function ns6slidew(){if(parseInt(ns6divw.style.left)>=sizeupw*(-1)){ns6divw.style.left=parseInt(ns6divw.style.left)-sspeed+"px";setTimeout("ns6slidew()",100);}else{ns6divw.style.left=wwidth+"px";ns6slidew();}}
//-- end Algorithm -->
</script>
<!-- End of Script between <head> & </head> tags-->
</head>
	<link rel="stylesheet" type="text/css" href="style.css" />

	<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
	<script type="text/javascript" src="js/jquery-easing-1.3.pack.js"></script>
	<script type="text/javascript" src="js/jquery-easing-compatibility.1.2.pack.js"></script>
	<script type="text/javascript" src="js/coda-slider.1.1.1.pack.js"></script>
	
	<script type="text/javascript">
	
		var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			clearInterval(theInt);
			
			if( typeof cur != 'undefined' )
				curclicked = cur;
			
			$crosslink.removeClass("active-thumb");
			$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
			
			theInt = setInterval(function(){
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
				curclicked++;
				if( 6 == curclicked )
					curclicked = 0;
				
			}, 3000);
		};
		
		$(function(){
			
			$("#main-photo-slider").codaSlider();
			
			$navthumb = $(".nav-thumb");
			$crosslink = $(".cross-link");
			
			$navthumb
			.click(function() {
				var $this = $(this);
				theInterval($this.parent().attr('href').slice(1) - 1);
				return false;
			});
			
			theInterval();
		});
	</script>
</head>

<body>
	
	<div id="page-wrap">
											
	<div class="slider-wrap">
		<div id="main-photo-slider" class="csw">
			<div class="panelContainer">

				<div class="panel" title="Panel 1">
					<div class="wrapper">
						<a href ="News396.php"><img src="images/teveznews396gallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							特维斯转会计划宣告流产,何去何从又成未知数</a><br />
							<span></span>
						</div>
					</div>
				</div>
				<div class="panel" title="Panel 2">
					<div class="wrapper">
						<a href ="MatchCommentatorComp.php"><img src="images/comgallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							想要成为赛事当天的实况广播员…<br />
							<span></span>
						</div>
					</div>
				</div>		
				<div class="panel" title="Panel 3">
					<div class="wrapper">
						<a href ="SignedShirtComp.php"><img src="images/shirtgallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							赢签名球衣大奖<br />
							<span></span>
						</div>
					</div>
				</div>	
				<div class="panel" title="Panel 4">
					<div class="wrapper">
						<a href ="GuessThePlayerComp.php"><img src="images/guessgallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							猜猜这名球员是谁<br />
							<span></span>
						</div>
					</div>
				</div>
				<div class="panel" title="Panel 5">
					<div class="wrapper">
						<a href ="MeetAPlayer.php"><img src="images/meetaplayergallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							赢得与一位明星球员见面的机会<br />
							<span></span>
						</div>
					</div>
				</div>
				<div class="panel" title="Panel 6">
					<div class="wrapper">
						<a href ="IanArgues.php"><img src="images/ianarguesgallery.png" alt="temp" /> </a>
						<div class="photo-meta-data">
							爵爷炮轰裁判根本没道理!<br />
							<span></span>
						</div>
					</div>
				</div>

			</div>
		</div>

		<a href="#1" class="cross-link active-thumb"><img src="images/teveznews396thumb.png" class="nav-thumb" alt="temp-thumb" /></a>
		<div id="movers-row">
			<div><a href="#2" class="cross-link"><img src="images/comthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div>
			<div><a href="#3" class="cross-link"><img src="images/shirtthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div>
			<div><a href="#4" class="cross-link"><img src="images/guessthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div>
			<div><a href="#5" class="cross-link"><img src="images/meetaplayerthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div>
			<div><a href="#6" class="cross-link"><img src="images/ianarguesthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div>
		</div>

	</div>
	
	</div>

</div>
</div>	
<br>
<br>
<!--<p class="byline"></p>-->

<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
				
					
			<h2 class="title"><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">蹴鞠吧 - 带英超回中国</div></h2>
				
				<div class="entry">
<div style="width:490px;height:179px;border-width:1px; border-style:dashed; border-color:grey">

					<center><p>欢迎来到<a href="AboutUs.php">蹴鞠吧</a>!蹴鞠吧是一家坐落于英国史塔福郡利奇菲尔德的有限公司。蹴鞠吧代表英超并向中国广大球迷观众朋友们推广和宣传英超与<a href="AboutUs.php">英超联赛</a>。网站报道<a href="News.php">独家英超新闻</a>,涵盖曼联,阿森纳,利物浦,切尔西,曼城等世界顶尖足球俱乐部的一手消息,同时包括不断更新的<a href="Table.php">英超积分榜</a>和<a href="Fixtures.php">英超赛程表</a>。我们同时在五星体育举办<a href="Competitions.php">短信竞猜</a>活动,请查看<a href="CompetitionWinners.php">短信竞赛详细信息</a>。我们目前与中国电视体育联播平台(CSPN),Titan,体邀网,hisports,Tom.com等国内知名体育网络紧密合作,为了让中国广大英超球迷能更近距离的感受英超,甚至有机会亲临英超赛场!</p></center>
					
	</div>							
</div>
</div>

		</div>

<br>
<br>


			<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
				
					
			<h2 class="title"><a href="ExclusiveNews4.php"><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">蹴鞠吧独家报道</div></a></h2>
				
				<div class="entry">
					<div style="width:490px;height:149px;border-width:3px; border-style:solid; border-color:#8C0209">


					<img src="images/footballthumbhomepage.png" alt="" width="100" height="100" align="left" style="border: 15px white solid;">
	
					<ul>
						<a href="News362.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">霍利尔因病离开,维拉官方证实开始寻找新帅</font></li> <a/>
						<a href="News391.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城拒绝巴西俱乐部邀约,不放走摇钱树特维斯</font></li><a/>
						<a href="News347.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城胜热刺保住欧冠门票,砸钱多年终得回报</font></li><a/>
						<a href="News346.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">红军状态全面复苏,下赛季叫板曼联</font></li><a/>
						<a href="ExclusiveNews4.php"><p style= text-indent:22.0em;>更多精彩新闻</p></a>
					</ul>

								
</div>

		</div>
</div>
</div>
<br>
<br>

<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
				
					
			<h2 class="title"><a href="FootballClubActivities6.php"><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">球队动向</div></a></h2>
				
				<div class="entry">
					<div style="width:490px;height:149px;border-width:3px; border-style:solid; border-color:#8C0209">
					<img src="images/soccerthumbhomepage.png" alt="" width="100" height="100" align="left" style="border: 15px white solid;">
		
					<ul>
						<a href="News396.php"><li><font face="Arialuni, 'Arial Unicode MS" size="2">特维斯转会计划宣告流产,何去何从又成未知数</font></li></a>
						<a href="News397.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城瞄准新目标,即将挖角阿奎罗</font></li></a>
						<a href="News395.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">维拉挖角曼城板凳门将,谢恩吉文期待第二春</font></li></a>
						<a href="News394.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">特维斯即将离开曼城,人缘好队友送祝福</font></li></a>
						<a href="FootballClubActivities6.php"><p style= text-indent:22.0em;>更多精彩新闻</p></a>
					</ul>
					
								
</div>
</div>

		</div>
</div>
<br>
<br>

<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
				
			<h2 class="title"><a href="GeneralNews4.php"><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">每日新闻</div></a></h2>
																			
				<div class="entry">
					<div style="width:490px;height:165px;border-width:3px; border-style:solid; border-color:#8C0209">
					<!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;">-->
				
					<!--<ul>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
					</ul>-->

					<center><table border="0" cellspacing="5">
						<tr>
 							 <td><a href="News345.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城2-1战胜切尔西,红魔目标双冠王</font></a></td>
 							 <td><a href="News329.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">莫耶斯希望时间倒转</font></a></td>
						</tr>
						<tr>
 							 <td><a href="News334.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">威尔希尔呼吁枪手们摆脱噩梦面向未来</font></a></td>
  							 <td><a href="News335.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">科尔:赢球的感觉是我前进的动力</font></a></td>
						</tr>
						<tr>
 							 <td><a href="News339.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">红蓝大战即将展开,曼联目标双冠王</font></a></td>
  							 <td><a href="News343.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">狼队3-1战胜西布朗,成功脱离降级区</font></a></td>
						</tr>
						<tr>
 							 <td><a href="News326.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">蓝队收到埃森这一重要助力</font> </a></td>
  							<td><a href="News352.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">爵爷深谋远虑,后悔没举旗向利物浦炫耀</font></a></td>																		   
						</tr>
						</table></center>
<a href="GeneralNews4.php"><p style= text-indent:33.0em;>更多</p></a>
					
					</div>		
</div>

		</div>
</div>
<br>
<br>

<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
				
				<h2 class="title"><a><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">英超精选图片</div></a></h2>
				
				<div class="entry">
<!--<div style="width:490px;height:115px;border-width:3px; border-style:solid; border-color:#0f2752 #00d0ff">-->
					<!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;">
				<br>
					<ul>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
					</ul>-->


<img alt="this is image #1" src="images/home1thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;"/>
<img alt="this is image #2" src="images/home2thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" />
<img alt="this is image #3" src="images/home3thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" />
<img alt="this is image #4" src="images/home4thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" />
<!--<a href="FootballClubActivities3.php"><p style= text-indent:22.0em;>更多</p></a>-->
					
					<!--</div>-->		
</div>

		</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>

			<div class="post">

				<!--<h2 class="title"><a></a></h2>
				<p class="byline"><small><a></a></small></p>-->
				<div class="post">
		<br>
<br>
		
				<h2 class="title"><a href="Video.php"><div style="background-image: url(http://www.cuju8.com/images/title.png );  background-repeat: no-repeat;   width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0;
	padding: 10px 15px 0px 15px; ">精彩视频</div></a></h2>
				
				<center><div class="entry">
<!--<div style="width:490px;height:115px;border-width:3px; border-style:solid; border-color:#0f2752 #00d0ff">-->
					<!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;">
				<br>
					<ul>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
						<li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li>
					</ul>-->

<a href="Video.php"><img alt="this is image #2" src="images/busbythumbhomepage.png" style="width:150px; height:100px; border:5px white;  padding:6px; float:left;" /></a>
<a href="Video.php"><img alt="this is image #1" src="images/arsenalthumbhomepage.png" style="width:150px; height:100px; border:5px white; padding:6px; float:left;"/></a>
<a href="Video.php"><img alt="this is image #3" src="images/wolvesthumbhomepage.png" style="width:150px; height:100px; border:5px swhite; padding:6px; float:left;" /></a>
					
					<!--</div>-->			
</div>

		</div></center>






			</div>

		</div>








		<!-- end content -->
		<!-- start sidebars -->
		<div id="sidebar2" class="sidebar">
			<ul>
				<li>
					<form id="searchform" method="get" action="http://www.baidu.com/">
						<div>
							<h2>搜索</h2>
							<!--<input type="text" name="s" id="s" size="15" value="Search" >-->
							<INPUT type="text" name="s" id="s" size="15" value="搜索" onfocus="if(this.value==this.defaultValue) this.value='';">
						</div>
					</form>
				</li>
				
				<?php include("CompInclude.php");?>
				
				<?php include("Subscribe.php");?>

				<li>
					<h2>Login</h2>
					<?php include("login.php");?>
				</li>

				<li>
					<h2>有奖竞赛日程表</h2>
					<?php include("calendar.php");?>
				</li>
				


				<li>
					<h2>山姆预测</h2>
					<ul>
						<li><a href="SamPredicts.php">纵观比赛全局,尽在山姆预测</a></li>
						
						
					</ul>
				</li>



			<li>
					<h2>向英超球星/主帅提问</h2>
					<ul>
						<li><a href="AskAManager.php">提问李青龙和麦卡锡</a></li>
						
						
					</ul>
				</li>

<li>
	
				
<!--<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 4,
  interval: 6000,
  width: 220,
  height: 300,
  padding:100,
  theme: {
    shell: {
      background: '#333333',
      color: '#ffffff'
    },
    tweets: {
      background: '#000000',
      color: '#ffffff',
      links: '#4aed05'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: false,
    hashtags: true,
    timestamp: true,
    avatars: false,
    behavior: 'all'
  }
}).render().setUser('cuju8').start();
</script>-->					
</li>
			</ul>
		</div>
		


<!-- end sidebars -->

		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
<div id="footer">
	<p class="copyright">&copy;&nbsp;&nbsp;2010年独家版权 &nbsp;&bull;&nbsp; 蹴鞫吧独家设计 <a href="AboutUs.php">CuJu8</a>.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://cuju8.com/forum/viewforum.php?f=10"><u>阿森纳</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=16"><u>利物浦</u></a> <a href="http://www.cuju8.com/index.php"><u>英超</u></a> <a href="http://www.cuju8.com/AboutUs.php"><u>英超联赛</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=12"><u>曼城</u></a> <a href="http://www.cuju8.com/Table.php"><u>英超积分榜</u></a> <a href="http://www.cuju8.com/Fixtures.php"><u>英超赛程表</u> </a><a href="http://www.cuju8.com/Table.php"><u>英超积分榜 2010</u></a> <a href="http://www.cuju8.com/Fixtures.php"><u>英超赛程</u></a> <a href="http://www.cuju8.com/News.php"><u>英超新闻</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=16"><u>利物浦队</u></a> <a href="http://www.cuju8.com/Table.php"><u>英超排名</u></a></p>
	<p class="link">版权权益&nbsp;&#8226;&nbsp;使用条款 </p>

</div>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18832652-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</body>
</html>

and the login.php is:

<?php
include("conf.inc.php"); // Includes the db and form info.
session_start(); // Starts the session.
if ($_SESSION['logged'] == 1) { // User is already logged in.
header("Location: index.php"); // Goes to main page.
exit(); // Stops the rest of the script.
} else {
    if (!isset($_POST['submit'])) { // The form has not been submitted.
        echo "<form action=\"login.php\" method=\"POST\">";
        echo "<table>";
        echo "<tr>";
        echo "<td colspan=\"2\">Login:</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"50%\">Username:</td><td width=\"50%\"><input name=\"username\" size=\"18\" type=\"text\" />";
        echo "</tr>";
        echo "<tr>";
        echo "<td width=\"50%\">Password:</td><td width=\"50%\"><input name=\"password\" size=\"18\" type=\"text\" />";
        echo "</tr>";
        echo "<tr>";
        echo "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"submit\"</td>";
        echo "</tr>";
        echo "</table>";
        echo "</form>";
    } else {
        $username = form($_POST['username']);
        $password = md5($_POST['password']); // Encrypts the password.
 
        $q = mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$password'") or die (mysql_error()); // mySQL query
        $r = mysql_num_rows($q); // Checks to see if anything is in the db. 
 
        if ($r == 1) { // There is something in the db. The username/password match up.
            $_SESSION['logged'] = 1; // Sets the session.
            header("Location: member.php"); // Goes to main page.
            exit(); // Stops the rest of the script.
        } else { // Invalid username/password.
            exit("Incorrect username/password!"); // Stops the script with an error message.
        }
    }
}
mysql_close($db_connect); // Closes the connection.
?>

Im just trying to include the login onto the homepage, i know the error says line 9 in the index file but with that commented out and it still say that.

Then line 5 in the login is this header line:

header("Location: index.php"); // Goes to main page.

is there something else i need to add to the index page?

Cheers

Hello,

You cannot use the header() function after you have already displayed some information to the page.

You are displaying tons of info, and only after that are you using the header function().

If you want to use the header() function, you must do it before you display any output, like right at the top of the page, before you any html or any echo.

There are two sollution I can think of. A quick way is to use JavaScript to redirect you to the main page.

Replace this line in the login.php

header("Location: index.php"); // Goes to main page.

with this one

echo "<script>window.location = 'index.php'</script>"; // Goes to main page.

The second way to solve this is to use something called "output buffering".
I have never really played around with this, but from what I've heard, this is what it does:
It automatically hold back any information you are trying to display until the last second, and then only display it.
While the output is being held back, you have a change to use the header() function.

Right at the top of you index.php file u use this funtction:

ob_start();

and right at the end of your index.php you use this function:

ob_end_flush();

@Some-jackass:-you are right.
the cause of error is because you are displaying something just before header.
So to remove it either don't display before header or use

ob_start();

at top and

ob_end_flush();

at end

Another alternative would be to use meta tag :

echo "<meta http-equiv=\"refresh\" content=\"2;url=http://www.example.com/\">";

The above code would wait for 2 seconds and redirect to www.example.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.