Foros del Web » Creando para Internet » Herramientas y Software »

session_start() [function.session-start]: Cannot send session cookie - headers alread

Estas en el tema de session_start() [function.session-start]: Cannot send session cookie - headers alread en el foro de Herramientas y Software en Foros del Web. hola me gustaria solucionar mi problema Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/omar2311/public_html/index.php:11) in /home/omar2311/public_html/includes/acceso.php on ...
  #1 (permalink)  
Antiguo 08/04/2013, 16:35
 
Fecha de Ingreso: abril-2013
Ubicación: ss
Mensajes: 3
Antigüedad: 11 años, 1 mes
Puntos: 0
Busqueda session_start() [function.session-start]: Cannot send session cookie - headers alread

hola me gustaria solucionar mi problema

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/omar2311/public_html/index.php:11) in /home/omar2311/public_html/includes/acceso.php on line 37
alguien tiene alguna ayuda les dejo mi codigo para que vean


<?php require_once('Connections/swiki.php');?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['id_email'])) {
$loginUsername=$_POST['id_email'];
$password=$_POST['id_contraseña'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "usuario.php";
$MM_redirectLoginFailed = "acceso_error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_swiki, $swiki);

$LoginRS__query=sprintf("SELECT id_email, `id_contraseña` FROM tabla_usuario WHERE id_email=%s AND `id_contraseña`=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "-1"));

$LoginRS = mysql_query($LoginRS__query, $swiki) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

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 );
}
}
?>

<form id="acceso" name="form1" method="POST" action="<?php echo $loginFormAction;?>">
<p>Email:
<label for="id_email"></label>
<input type="text" name="id_email" id="id_email" />
</p>
<p>Contraseña:
<label for="id_contraseña"></label>
<input type="text" name="id_contraseña" id="id_contraseña" />
</p>
<p>
<input type="submit" name="button" id="button" value="Entrar" />
</p>
</form>
  #2 (permalink)  
Antiguo 25/04/2013, 02:56
Avatar de Developando  
Fecha de Ingreso: abril-2013
Mensajes: 48
Antigüedad: 11 años
Puntos: 5
Respuesta: session_start() [function.session-start]: Cannot send session cookie - hea

ese error te puede salir si existe algún espacio en blanco antes del '<?php' o despues de '?>'. Revisa que no tengas algún salto de línea antes.

Si eso no es, el error está en que session_start() debe ser ejecutado antes de cualquier salida HTML porque envía headers HTTP al navegador, revisa que es así.

Etiquetas: cookie, editores-web, headers, php, send, session
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:25.