Session_Start(); Error
Posted: Thu Jan 20, 2011 8:20 am
Guys,
I'm wondering if I can get some kind of help on these forums. I am creating a Web Application for my company everything is going well except I am getting the following error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\Home.php:1) in C:\xampp\htdocs\auth.php on line 2
What happens is, if the user logs in successfully with the correct credentials he/she is displayed a welcome screen then redirected to Home.php
I've checked multiple areas on the internet for this error and they all seam to say the same thing (make sure session_start(); has no whitespaces or blank lines), however, I believe that this is not the case and that there may be a problem with my code that I am using, nonetheless, this error is displayed, however, what I want this to do works even if the error is still there. All I want to do is make this error disappear and the code still work. lol
Here is the Code for Home.php
Here is the code for auth.php
Also, please keep in mind that Session_Start(); was used in the welcome screen before being redirected to Home.php.
Any help is much appreciated.
Richard aka POINTBLANK0704
I'm wondering if I can get some kind of help on these forums. I am creating a Web Application for my company everything is going well except I am getting the following error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\Home.php:1) in C:\xampp\htdocs\auth.php on line 2
What happens is, if the user logs in successfully with the correct credentials he/she is displayed a welcome screen then redirected to Home.php
I've checked multiple areas on the internet for this error and they all seam to say the same thing (make sure session_start(); has no whitespaces or blank lines), however, I believe that this is not the case and that there may be a problem with my code that I am using, nonetheless, this error is displayed, however, what I want this to do works even if the error is still there. All I want to do is make this error disappear and the code still work. lol
Here is the Code for Home.php
Code: Select all
<?php
require_once('auth.php');
require_once('Setupstyles.css');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-ca" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="Setupstyles.css" rel="stylesheet" type="text/css" />
<title>FORM</title>
</head>
<body>
<form method="post" action="logout.php" style="width: 1443px; height: 107px">
<div style="position: absolute; width: 21%; height: 20px; z-index: 1; left: 70%; top: 17%;" id="layer1" class="style7">
Welcome <b><i><?php echo ($_SESSION['SESS_FIRST_NAME']); echo (' '); echo ($_SESSION['SESS_LAST_NAME']);?></i></b></div>
<input name="Logout" type="submit" value="Logout" style="z-index: 1; position: absolute; top: 17%; left: 92%" />
</form>
Code: Select all
<?php
session_start();
//Check whether the session variable SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
header("location:denied.php");
exit();
}
?>
Any help is much appreciated.
Richard aka POINTBLANK0704