0
<?php
include 'ProcessDAO.php';
$dest="";
if(isset($_POST['login'])){
    session_start(); // i get an error in this line !!
    $_SESSION['status']='online';
    $_SESSION['breadcrumb']='home';
    $pro = new ProcessDAO();
    $dest = $pro->LogIn($_POST['username'],$_POST['password']);
}else{
    session_start();
    $dest ="Location: ../index.php";
    session_destroy();
}
header($dest);
?>

guyss can you help me out because in my Login.PHP file when i login i always get this error .

** Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\IPMS\process\ProcessDAO.php:1) in C:\xampp\htdocs\IPMS\process\login.php on line 5**

3
Contributors
6
Replies
19
Views
4 Years
Discussion Span
Last Post by mshihabudeenlabba
1

@syria718

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\IPMS\process\ProcessDAO.php:1) in C:\xampp\htdocs\IPMS\process\login.php on line 5

May I ask why you have 2 session_start() function?

The reason why you got that error because you have 2 session_start() function! There should be only 1 session_start() function per page.

Try to put your session_start() function on top of your code instead of being in the middle.

From this:

<?php
include 'ProcessDAO.php';
$dest="";
if(isset($_POST['login'])){
session_start(); // i get an error in this line !!
$_SESSION['status']='online';
$_SESSION['breadcrumb']='home';
$pro = new ProcessDAO();
$dest = $pro->LogIn($_POST['username'],$_POST['password']);
}else{
session_start();
$dest ="Location: ../index.php";
session_destroy();
}
header($dest);
?>

To this:

<?php
session_start();
include ("ProcessDAO.php");
$dest="";
if(isset($_POST['login'])){
$_SESSION['status']='online';
$_SESSION['breadcrumb']='home';
$pro = new ProcessDAO();
$dest = $pro->LogIn($_POST['username'],$_POST['password']);
}else{
$dest = 'location: ../index.php';
session_destroy();
}
header($dest);
?>
0

thanks for that i did not get the same error again .. but what i get was these error when i transfer the session_start(); on top of my code ..

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\IPMS\process\ProcessDAO.php:1) in C:\xampp\htdocs\IPMS\process\login.php on line 14

Edited by syria718: change in error message

1

@syria718

thanks for that i did not get the same error again .. but what i get was these error when i transfer the session_start(); on top of my code ..

Did you write this code?

The reason why you got that error because you have 2 header which you should have only 1 header.

Take out line 14:

header($dest);

Edited by LastMitch: grammer

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.