[PHP-JS] Problème sur le header : headers already sent
Bonjour,
J'ai un tout petit (ironnique) problème de header. Cela produit lorsque je visite une page
Code:
1 2 3 4 5 6 7
| <?php
require_once("../include/header.php");
$object = new User($_POST['login'], $_POST['passwd']);
$_SESSION["user0"]=serialize($object);
header("Location: ".$_SERVER['HTTP_REFERER']."/../panel.phtml"); // big error
?> |
mais voila qu
Code:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\test\include\header.php:5)
je suis obligé de remplacer le header location par
Code:
1 2
| echo '<script type="text/javascript">document.location.replace("'.
$_SERVER['HTTP_REFERER'].'/../panel.phtml")</script>' |
mais c'est pas très joli et si l'utilisateur à désactiver javascript
alors que mon header.php est un truc tout simple
sans header : content type
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <?php
session_start();
error_reporting(E_ALL);
$tab = explode("/", $_SERVER['SCRIPT_FILENAME']);
echo count($tab);
$page= $tab[count($tab)-1];
$css = array ();
switch(count($tab))
{
case 7 : // root
require_once("class/User.php");
$css['general']="stylesheet/general.css";
$css['toot']="stylesheet/skyrecon.css";
break;
case 8 : // script level
require_once("../class/User.php");
$css['general']="../stylesheet/general.css";
$css['toot']="../stylesheet/skyrecon.css";
break;
}
$debug=false;
$path="log.txt";
?> |