Código PHP:
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "id_perfil";
$MM_redirectLoginSuccess = "listado.php";
$MM_redirectLoginFailed = "listado.php?error=Datos Incorrectos";
$MM_redirecttoReferrer = false;
mysql_select_db($database_chistesvip, $chistesvip);
$LoginRS__query=sprintf("SELECT nombre_web, pass, id_perfil FROM owners WHERE nombre_web='%s' AND pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $chistesvip) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'id_perfil');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
//
$nn=$_POST['user'];
mysql_select_db($database_chistesvip, $chistesvip);
$query_crea_cookie = "SELECT owners.id_ow FROM owners WHERE owners.nombre_web ='$nn'";
$crea_cookie = mysql_query($query_crea_cookie, $chistesvip) or die(mysql_error());
$row_crea_cookie = mysql_fetch_assoc($crea_cookie);
$totalRows_crea_cookie = mysql_num_rows($crea_cookie);
$valor = $row_crea_cookie['id_ow'];
[COLOR="Red"] setcookie("id_usuario", $valor); ////aca es la linea 215, donde da error[/COLOR]
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
Ademas de que no me escribe la cookie, me tira el siguiente error
Warning: Cannot add header information - headers already sent by (output started at c:\appserv\www\chistesvip\listado.php:30) in c:\appserv\www\chistesvip\listado.php on line 215
y dos lineas mas abajo..
Warning: Cannot add header information - headers already sent by (output started at c:\appserv\www\chistesvip\listado.php:30) in c:\appserv\www\chistesvip\listado.php on line 217