Jump to content

Headers already sent


3raser

Recommended Posts

I know what the error means. And I tried bypassing it like so:

 

<?php function setDaCookie() { setcookie('session', $_SERVER['REMOTE_ADDR'], time() + 3600); }?>

 

Total code:

 

<?php function setDaCookie() { setcookie('session', $_SERVER['REMOTE_ADDR'], time() + 3600); }?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Team Cataclysm</title>

<meta name="Description" content="" />
<meta name="author" content="" />
<meta name="Keywords" content="" />

<meta name="robots" content="all,follow" />


<!-- ===== CSS ===== --> 
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection, tv" />
<link rel="stylesheet" href="css/style-print.css" type="text/css" media="print" />


<!-- ===== JavaScript ===== --> 
<meta http-equiv="Content-Script-Type" content="text/javascript" />


<!-- ===== RSS ===== --> 


<!-- ===== Favicon ===== -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>

<body>

<div id="obal">
<div id="page">
	<div id="header">
	<h1><a href="#" title="Click to enter Homepage">Team Cataclysm Application Page</a></h1>
	<p>Spread the grief, laugh at the aftermath, and uphold a new generation of griefers...</p>
	</div>

	<hr class="noscreen" />

	<div id="col"><div id="col-in">

	<h2>Access applications viewer</h2>
	<!-- <img class="floating" src="img/foto.jpg" alt="Cactus" width="166" height="106" /> -->
	<p>
	<?php
		mysql_connect("localhost", "568969_justin", "pebopebo");
		mysql_select_db("team-cataclysm_zxq_data");

		$cookie = $_COOKIE['session'];
		$pass = mysql_real_escape_string($_POST['pass']);

		if(empty($pass) && !$cookie)
		{
			?>
			<form action="acp.php" method="POST">
				PASS: <input type="text" name="pass" maxlength="20"> <input type="submit" value="Verify">
			</form>
			<?php
		}
		elseif($pass != "removed" && !$cookie)
		{
			?>
			<p><span style="red">ACCESS DENIED. LOGGED.</span></p>
			<?php
		}
		elseif($_GET['accept'] || $_GET['deny'] && $cookie)
		{
			if($_GET['accept'])
			{
				mysql_query("UPDATE applications SET status = 1 WHERE id = ". $_GET['accept'] ."");
				echo "Application successfully accepted. <a href='acp.php'>Back</a>";
			}
			else
			{
				mysql_query("UPDATE applications SET status = 2 WHERE id = ". $_GET['accept'] ."");
				echo "Application successfully denied. <a href='acp.php'>Back</a>";
			}
		}
		else
		{
			if(!$cookie) setDaCookie();
			$query = mysql_query("SELECT id,status,about_me,ip,date,username,location FROM applications WHERE id = 0 ORDER BY id DESC");
			if(mysql_num_rows($query) < 1)
			{
				echo "No applications to display.";
			}
			else
			{
				while($row = mysql_fetch_assoc($query))
				{
					echo "USERNAME: <b>". $row['username'] ."</b> LOCATION: <b>". $row['location'] ."</b><br/>";
					echo "ABOUT: <span style='color:green'>". $row['about_me'] ."</span><br/>";
					echo "<a href='acp.php?accept=". $row['id'] ."'>ACCEPT</a> | <a href='acp.php?accept=". $row['id'] ."'>DENY</a>";
					echo "<hr><br/><br/>";
				}
			}

		}
	?>
	</p>

	</div></div>

	<hr class="noscreen" />

	<div id="footer"><div id="footer-in"><a href="http://www.pestujemeweb.cz/">Pestujeme web</a> | <a href="http://www.letenkylevneji.cz" title="Levné Letenky">Letenky</a></div></div>
</div>

<ul id="menu"><li><a href="index.php">Home</a></li> <li><a href="#">View App</a></li></ul>
</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/246941-headers-already-sent/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.