note 108150 deleted from function.session-start by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 12:18:24 +0000 |
| Subject: | note 108150 deleted from function.session-start by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197165@lists.php.net to get a copy of this message | ||
Note Submitter: Doug__fernandes at hotmail dot com
----
ERROR Warning: session_start() [function.session-start]: Cannot send session cookie - headers
already sent by (output started at
<?php
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=md5($_POST['senha']);
$MM_fldUserAuthorization = "usuarioNivel";
$MM_redirectLoginSuccess = "admin/painel.php";
$MM_redirectLoginFailed = "admin/erro.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_painel_config, $painel_config);
$LoginRS__query=sprintf("SELECT email, senha, usuarioNivel FROM up_clientes WHERE email=%s
AND senha=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password,
"text"));
$LoginRS = mysql_query($LoginRS__query, $painel_config) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'usuarioNivel');
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>