Jump to content
Forum Roportal
Panait.nicu88

Problema Cannot send session cache limiter - headers already

Rate this topic

Recommended Posts

Buna ziua!

De ceva timp mi-a aparut o eroare in program si nu reusesc sa o rezolv. Eroarea este aceasta Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rcur5746/manager.cursuri10plus.ro/registru-eliberare-diplome.php:1) in /home/rcur5746/manager.cursuri10plus.ro/functions/start.php on line 5 iar codul din start.php este acesta:

<?php
ob_start();

session_name("dacians_admin");
session_start();


if(isset($_POST['login_attempt'])){
$password = MD5($_POST['password']);
$username = $_POST['username'];
$queryUseri = $db->query("SELECT * FROM `users` WHERE Status = '1' AND `UserName` = '".$_POST['username']."' AND `PassWord` = '".$password."'");

if($Useri = $queryUseri->fetch_object()){
$_SESSION['user']=$Useri->IDUser;
$_SESSION['level']=$Useri->Level;

header("Location: ".$_POST['url']);
} else {print ($db->error);}

}

if($_GET['logout'] == 1){
session_unset();
header("Location: index.php");
ob_end_flush();

}



if(!isset($_SESSION['user'])){?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Cursuri 10 Plus</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/gif" href="images/favicon.gif" />
<script type="text/javascript" src="/javascript/external.js"></script>
</head>
<body>
<div id="site">
<div class="container4">
 

<div id="content">
<div id="login-form">

<form method="post" action="<?=$_SERVER["REQUEST_URI"];?>">
<fieldset>
<legend>Autentificare</legend>
<input type="hidden" value="<?=$_SERVER["REQUEST_URI"];?>" name="url" />
<dl><dt>Utilizator</dt>
<dd><input type="text" name="username" /></dd>
<dt>Parola</dt>
<dd><input type="password" name="password" /></dd>
<input type="submit" name="login_attempt" value="Intra" class="submit" />
<div id="autentificare">
<? if($_GET['logout'] == 1){ ?>
Ai fost deconectat!
<? } else { ?>
Această arie necesită autentificare!
<? } ?>
</div>
</fieldset>
</form>


</div>

</div>
</div>
</body>
</html>
<?php
die();
}
?>

Daca m-ati putea ajuta as fi recunoscator.Va multumesc!

Share this post


Link to post
Share on other sites

Mai ai o sesiune deschisă în registru-eliberare-diplome.php, iar dacă se mai apelează odată încă un php care mai generează o sesiune atunci primeşti o astfel de eroare.

Share this post


Link to post
Share on other sites

Problema apare deoarece partea de HEADER a documentului HTML a fost deja trimisa catre browser. Ca sa rezolvi problema asta trebuie sa vezi cine trimite header inainte de momentul in care vrei tu sa il trimiti, asta fiind solutia corecta. Daca vrei doar sa-ti mearga iti poti activa in config-ul de PHP optiunea de output_buffering.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×