Hello!
I have this problem: when user clicks on link it needs create cookie with parameter “1”, which will “live” 1 hour, but i get only this error: Warning: Cannot modify header information – headers already sent by (output started at Z:homelocalhostwwwphpsge-sltpldefaultindex.php:37) in Z:homelocalhostwwwphpsge-sltpldefaultindex.php on line 44
How can be this problem solved?
[code]<?
if(isset($_GET[‘id’])){
connect();
$a = mysql_query(“select * from servers WHERE id =”.$_GET[‘id’].””);
while($up = mysql_fetch_array($a, MYSQL_ASSOC) ){$upd = $up[rank] + 1; }
mysql_query(“UPDATE servers SET `rank` = “.$upd.” WHERE `id` ='”.$_GET[‘id’].”‘”);
SetCookie(“phpSGE-SL-Vote”,”1″);
header(‘location: ./’.$PHP[‘SELF’].”);
}
?>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
<title>{Title}</title>
<meta name=”keywords” content=”” />
<meta name=”description” content=”” />
<link href=”./tpl/default/default.css” rel=”stylesheet” type=”text/css” />
</head>
<body>
<div id=”outer”>
<div id=”header”>
<h1><a href=”#”>{SiteName}</a></h1>
<h2>{SiteDesc}</h2>
</div>
<div id=”menu”>
<ul>
<li class=”first”><a href=”#” accesskey=”1″ title=””>Home</a></li>
<li><a href=”./addserver.php” accesskey=”2″ title=””>Add Server</a></li>
</ul>
</div>
<div id=”content”>
<div id=”xbg1″></div>
<div id=”primaryContentContainer”>
<div id=”primaryContent”>
<h2>Last Servers</h2>
<table>
<?
connect();
$q = mysql_query(“select * from servers”);
(!$q) ? die(‘ERROR #1! ‘) :”;
while($r = mysql_fetch_array($q, MYSQL_ASSOC) ) {
echo ‘
<tr class=”rowA”><td>’.$r[rank].”;
if (SetCookie(“phpSGE-SL-Vote”,”1″)){
echo “”;
}else{
echo ‘<a href=”?id=’.$r[id].'”>[+1]</a>’;
}
echo ‘</td><td>’.$r[name].'</td><td><a href=”‘.$r[link].'”>Connect!</a></td></tr>’;
}
?>
</table>
</div>
</div>
<div id=”secondaryContent”>
<h3>Menu</h3>
<p><a href=”./index.php”>Home</a><br />
<a href=”./addserver.php”>Add Server</a><br />
<a href=”http://amxdm-fortes.tk/phpsge-gl”>phpSGE GL page</p>
<h3>Text</h3>
<p>Sed eu eros imperdiet eros interdum blandit. Vivamus sagittis bibendum erat. Curabitur malesuada. <a href=”#”>More…</a></p>
<h3>Text</h3>
<p>Sed vestibulum blandit nisl. Quisque elementum convallis purus. Suspendisse potenti. Donec nulla est, laoreet quis, pellentesque in. <a href=”#”>More…</a></p>
<h3>Text</h3>
<ul>
<li><a href=”#”>Sagittis Bibendum Erat</a></li>
<li><a href=”#”>Malesuada Turpis</a></li>
<li><a href=”#”>Quis Gravida Massa</a></li>
<li><a href=”#”>Inerat Viverra Ornare</a></li>
</ul>
</div>
<div class=”clear”></div>
</div>
<div id=”footer”>
<p>Copyright © {Year} {Title}<br />
Powered by <a href=”http://amxdm-fortes.tk/phpsge-sl”>phpSGE SL</a> Project. Coded by <a href=”http://www.amxdm-fortes.tk”>Nikita [Fortes] Kushnir</a>. Designed by <a href=”http://www.freecsstemplates.org”>Free CSS Templates</a></p>
</div>
</div>
</body>
</html>
pS: Sorry for my bad English.
Nikita