...

View Full Version : PHP function Session_start() problem



deshi2003
03-14-2009, 06:42 PM
i am facing the following problem but i am not understanding how can i solve this problem.
i have a page named writeblog.php where without login access is denied.the code is as follows



3.session_start();
4.if (!isset($_SESSION['username']))
{
header('Location:index.php?redirection=' . urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) );
exit;

}

when i go this page the following warning is occured

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\wamp\www\blog\Readblog.php:2) in D:\wamp\www\blog\Readblog.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\wamp\www\blog\Readblog.php:2) in D:\wamp\www\blog\Readblog.php on line 4
please help me out

include('prac.php');



?>

abduraooft
03-14-2009, 06:52 PM
Check the notes in the manual of session_start() (http://php.net/session_start)

Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

Reading http://www.codingforums.com/showthread.php?p=300877#post300877 might also help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum