0

am getting Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent while running the following code. please help to fix it.. thanks.

<html>
<!-- centermain.php is a frame, user redirected to frame if tried to access from url-->
<SCRIPT LANGUAGE='javascript'>try { if (top == self) {top.location.href='centermain.php'; } } catch(er) { } </SCRIPT>
</html>
<?php
session_start();// initialize session
//code
?>

4
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by smrict
0

TRY THIS

<?php session_start();  ?>
<?php ob_start(); ?>
<html>
<!-- centermain.php is a frame, user redirected to frame if tried to access from url-->
<SCRIPT LANGUAGE='javascript'>try { if (top == self) {top.location.href='centermain.php'; } } catch(er) { } </SCRIPT>
</html>


<?php ob_end_flush();?>
0

You code is not working because session_start(); ALWAYS MUST BE FIRST IN THE FILE...

0
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\emohonv2\module-srksmka.php:293) in C:\xampp\htdocs\emohonv2\auth.php on line 3

Code:

<?php
//Start session
session_start();
//Check whether the session variable
//SESS_MEMBER_ID is present or not
if(!isset($_SESSION) || (trim($_SESSION)=='')) {
header("location: access-denied.php");
exit();
}
?>

Edited by pyTony: fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.