Jump to content

Warning: Cannot modify header information - headers already sent by


Recommended Posts

I've just knocked up a quick login system using cookies and when I run my login script I get this error:

Warning: Cannot modify header information - headers already sent by (output started at \var\www\web\header.php:9) in \var\www\web\login.php on line 31

 

here is my header.php script:

 

<?php
session_start();
require_once "inc.php";
?>
<html>
<head>
<title>.: Video Streaming >></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.kiri {
 background-image: url(gambar/tmp_11bg.gif);
 background-repeat: repeat-y;
}
.kanan {
 background-image: url(gambar/tmp_10bg.gif);
 background-repeat: repeat-y;
 width: 40px;
}
.tekssatu {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 11px;
 color: #FFFFFF;
}
.teksdua {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 11px;
 color: #000000;
}
.tekstiga {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 10px;
 color: #000000;
}
.tengah {
 background-image: url(gambar/tmp_02bg.gif);
 background-repeat: repeat-x;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 10px;
 color: #FFFFFF;
}
a:link,a:active,a:visited {
 color : #FF6600;
 text-decoration: none;
}
a:hover	   { text-decoration: underline; color : #FF0000; }
.mainmenu		    {
 font-weight: bold;
 font-size: 12px;
 color : #006699;
 text-decoration: none;
}
a.mainmenu	   { test-decoration: none; color : #006699; }
a.mainmenu:hover{ text-decoration: underline; color : #DD6900; }

input,textarea, select {
 color : #000000;
 font: normal 11px Verdana, Arial, Helvetica, sans-serif;
 border: 1px #000000;
}
/* The text input fields background colour */
input.post, textarea.post, select {
 background-color : #FFFFFF;
}

input { text-indent : 2px; }

/* The buttons used for bbCode styling in message post */
input.button {
 background-color : #EFEFEF;
 color : #000000;
 font-size: 11px;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 border: 1px solid #000000;
}

/* The main submit button option */
input.mainoption {
 background-color : #FAFAFA;
 font-weight : bold;
}
input.maindua {
 background-color : #FAFAFA;
 font-weight : bold;
 border: 1px solid #000000;
}
.garis {
 border: 1px solid #000000;
}
.judul {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 13px;
 font-weight: bold;
 color: #FF6600;
 text-decoration: none;
}
tr.header {
 font-weight: bold;
 border: solid #000000;
 height: 20px;
 bakground-color: #A6D2FF;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 13px;
 color: #FF6600;
 text-decoration: none;
}
-->
</style>
</head>

<body background="gambar/bg.gif">
<table width="646" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
  <td width="297"><img src="gambar/tmp_01.gif" width="297" height="51"></td>
  <td class="tengah" width="100%"><marquee direction="left" scrollamount="10" scrolldelay="200">Welcome to Adaptive Video Streaming with MPEG-4 Encoding</marquee></td>
  <td width="40" align="right"><img src="gambar/tmp_03.gif" width="40" height="51"></td>
</tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
  <td width="162" height="70"><img src="gambar/tmp_04.gif" width="162" height="70"></td>
  <td width="161"><img src="gambar/tmp_05.gif" width="161" height="70"></td>
  <td width="162"><img src="gambar/tmp_06.gif" width="162" height="70"></td>
  <td width="161"><img src="gambar/tmp_07.gif" width="161" height="70"></td>
</tr>
    </table></td>
  </tr>
  <tr>
    <td width="100%"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
  <td class="kiri" width="122" valign="top" height="100%"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
	<td width="122" height="126"><img src="gambar/tmp_08.gif" width="122" height="126"></td>
    </tr>
    <tr>
	<td height="100%" align="center" background="gambar/tmp_11bg.gif" class="kiri">
		    <? if (emptyString($_COOKIE[id])){ ?>
		    <form action="login.php" method="post">
		    <div class="tekssatu">Username : <br>
		      <input type="text" name="usrnm" size="10" class="mainoption">
		    <br>
		    Password : <br>
		      <input name="psw" type="password" size="10" class="mainoption">
		    <br><br>
		      <input type="submit" value="login >>" class="button">
		    </div>
		    </form>
		    <? } else { ?>
		    <div class="mainmenu">
		    <a href="/admin.php"><img src="gambar/administrator.gif" width="38" height="38" border="0"><br>
		      Administrator</a>
		    <br>
		    <a href="/login.php?mod=logout"><img src="gambar/logout.gif" border="0"><br>
			LOGOUT</a></div><br>
		    <div class="teksdua">Camera<br>Position<br><br>
		    <table width="70" border="0" cellpadding="0" cellspacing="5" class="tekssatu">
  <tr align="center">
    <td><a href="/cgi-bin/kamera_cw.cgi">cw</a></td>
    <td><a href="/cgi-bin/kamera_ccw.cgi">ccw</a></td>

/*Script di atas digunakan untuk menggerakkan kamera dari website*/

  </tr>
  </table>
	   </div>
		    <? }?></td>
    </tr>
  </table></td>
  <td width="484" align="center" valign="top" bgcolor="#FFFFFF">
	   <?
	   if (emptyString($_COOKIE[id])){
	   ?>
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
	<tr align="center">
	  <td><a href="open.php"><img src="gambar/g2.jpg" width="60" height="60"></td>
	  <td><a href="video.php"><img src="gambar/g1hidden.jpg" width="60" height="60"></td>
	  <td><a href="viewpict.php"><img src="gambar/g3hidden.jpg" width="60" height="60"></td>
	  <td><a href="viewtrafik.php"><img src="gambar/g4hidden.jpg" width="60" height="60"></td>
	  <td><a href="help.php"><img src="gambar/g5hidden.jpg" width="60" height="60"></td>
	</tr>
	<tr align="center" class="teksdua">
	  <td><a href="open.php">Open Streaming</td>
	  <td><a href="video.php">Video Capture </td>
	  <td><a href="viewpict.php">View Capture </td>
	  <td><a href="viewtrafik.php">View Traffic </td>
	  <td><a href="help.php">Help</td>
	</tr>
    </table><? } else {?>
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
	<tr align="center">
	  <td><img src="gambar/g2.jpg"></td>
	  <td><a href="video.php"><img src="gambar/g1.jpg" border="0"></a></td>
	  <td><a href="viewpict.php"><img src="gambar/g3.jpg" border="0"></a></td>
	  <td><a href="http://www.10.14.200.2:3001"><img src="gambar/g4.jpg" border="0"></a></td>
	  <td><a href="/help.php"><img src="gambar/g5.jpg" border="0"></a></td>
	</tr>
	<tr align="center" class="teksdua">
  <td><a href="/open.php">Open Streaming</a></td>
  <td><a href="/video.php">Video Capture</a> </td>
  <td><a href="/viewpict.php">View Picture</a> </td>
  <td><a href="/viewtrafik.php">View Traffic</a> </td>
  <td><a href="/help.php">Help</a></td>
	</tr>
    </table> <? }?> <br><br>

and here is my login.php script :

<?
include "header.php";
switch ($mod){
 case "logout" : /*session_unregister($_SESSION[usrnm]);
					 $_SESSION[usrnm] = "";
					 unset($_SESSION[usrnm]);

 session_unregister($_SESSION[id]);
					 $_SESSION[id] = "";
					 unset($_SESSION[id]);*/
					 setcookie("username","");
					 setcookie("id","");
					 message_url("Anda telah logout..Terima kasih atas kunjungannya!!!","/");
					 break;

 default :
	   if (emptyString($_POST[usrnm])) message_back('Username belum diisi');
	   if (emptyString($_POST[psw])) message_back('Password belum diisi');
	   //cek di table (proses authentifikasi)
	   $pass_md5 = md5($_POST[psw]);
	   $qr = mysql_query("SELECT * FROM stream WHERE username='$_POST[usrnm]' AND password='$pass_md5'");
	   $loaduser = mysql_fetch_assoc($qr);

	   if (mysql_num_rows($qr) == '1'){
		    /*Create session
		    session_register("usrnm");
		    $_SESSION[usrnm]="$loaduser[username]";
		    session_register("id");
		    $_SESSION[id]="$loaduser[id]";*/

 setcookie("username","$loaduser[username]");
 		    setcookie("id","$loaduser[id]");
		    message_url("Selamat Datang $loaduser[nama]","/admin.php");
	   } else {
		    message_back('Username/Password Anda salah... data tidak ditemukan');
	   }
	   break;

}
include "footer.php";
?>

 

This is really killing the functionality of the site.Any help would be greatly appreciated.

 

(edited by kenrbnsn to add


tags)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.