Well guys this is the first time iam actually using php... i encountered these errors .. can some one tell me how i can rectify them

Error:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/dynastyr/public_html/rebellion-rpg/header.php:7) in /home/dynastyr/public_html/rebellion-rpg/header.php on line 7

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/dynastyr/public_html/rebellion-rpg/header.php:7) in /home/dynastyr/public_html/rebellion-rpg/header.php on line 7

Here is the Lines from the source code:

<head><title>Rebellion-RPG</title>
<link rel=stylesheet href=style.css>
</head><body leftmargin=0 rightmargin=0 onload="window.status='ExoFusion [v3]'">

<?php include("config.php"); include("game_funcs.php"); session_start(); ?>
<?php
if (!session_is_registered("email") || !session_is_registered("pass")) {
print "Sesion has expired.";
exit;
}
$stat = mysql_fetch_array(mysql_query("select * from players where email='$email' and pass='$pass'"));

if (empty ($stat[id])) {
print "Invalid login.";
exit;
}
$ctime = time();
mysql_query("update players set lpv=$ctime where id=$stat[id]");

$ip = "$HTTP_SERVER_VARS[REMOTE_ADDR]";
mysql_query("update players set ip='$ip' where id=$stat[id]");
mysql_query("update players set page='$title' where id=$stat[id]");
?>

" Well Please guys i need help...!! Please reply asap " thanks.. Sal

Due to a restriction in the HTTP Protocol, YOU HAVE TO SEND COOKIES AND OTHER HEADER DATA BEFORE ANY OUTPUT. The best way I can think of doing that without to many drastic changes would be to move the first php line to the very top. If that chnges the overall output, then put it back and add <?php ob_start(); ?> to the very top, which tells PHP to hold onto output until ob_flush(), ob_end() or the end of the script is encountered, thereby allowing you to define cookies where you want. BTW, ob stands for Output Buffering, in case you were interested.

Oh god! PLEASE PLEASE could i have that Exofusion release? It seems to be the only one in existance!

This article has been dead for over six months. Start a new discussion instead.