| | |
Need Help Correcting These errors
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2004
Posts: 1
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2003
Posts: 282
Reputation:
Solved Threads: 6
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.
![]() |
Similar Threads
- write to outfile (MySQL)
- Inventory Application for DVDs (Java)
- review my site (Website Reviews)
- Hamming codes encoder/decoder in C or C++ (C++)
Other Threads in the PHP Forum
- Previous Thread: can some 1 teach me some php?
- Next Thread: PHP and MySql
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code codingproblem cron curl customizableitems database date display dynamic echo email error errorlog file files filter folder form format forms forum function functions gc_maxlifetime global google headmethod host href htaccess html image include insert ip javascript joomla limit link login mail malfunctioning memmory memory menu mlm multiple mysql nodes oop parameter parsing paypal pdf php phpmysql problem query radio random recursion recursiveloop remote script search select server sessions sms snippet source space sql static survey syntax system table trouble tutorial up-to-date update upload url validator variable video web youtube





