Re: Warning: Cannot add header information
| From: | Gastón Gorosterrazú | Date: | Thu, 13 Sep 2001 05:19:39 +0000 |
| Subject: | Re: Warning: Cannot add header information | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-13781@lists.php.net to get a copy of this message | ||
Fijate la línea 20 de Login.php, borrala, sacale espacios de mas, etc. y te
va a funcionar.
En esa línea exactamente hay algún caracter que hace que envíe algo al
cuerpo del mensaje, cuando ya enviaste al cuerpo, no puedes modificar la
cabecera, que es lo que hace el "header".
Saludos
----- Original Message -----
From: "Barra Home - Root" <root@barrahome.com>
To: <lista@phpes.com>
Sent: Thursday, September 13, 2001 1:46 AM
Subject: [PHP-ES] Warning: Cannot add header information
Tengo este problema , cuando el user se loguea a traves de un Form lo tiene
que redireccionar a una url , y tonces uso el Header , pero me dice
Warning: Cannot add header information - headers already sent by (output
started at /home/httpd/vhost/hosting/html/Login.php:20) in
/home/httpd/vhost/hosting/html/Login.php on line 21
Aca les pasteo el Login.php
<?
$connection = mysql_connect("localhost", "root", "uksuvaso")
or die ("Couldn't connect to server.");
$db = mysql_select_db("kzt_secret", $connection)
or die ("Couldn't select database.");
$sql = "SELECT id
FROM kzt_secret
WHERE IDUser='$IDUser' and IDPass='$IDPass'";
$result = mysql_query($sql)
or die("Couldn't execute query.");
$num = mysql_numrows($result);
if ($num == 1) {
header("Location: $IDRedir");
} else if ($num == 0) {
echo "You are not authorized!";
}
?>