Erreur sur authentification du protocole HTTP
Bonjour a tous,
Je patines depuis quelques heure avec mon script pour l'identification d'accès au back-office géré par authentification du protocole HTTP (est-ce la bonne solution?).
En local avec ce code tous allait bien mais dès que je test sur serveur voici les trois messages d'erreur concernant les 3 header sans aucune apparition du popup d'authentification :(.
Les messages d'erreur :
Warning: Cannot modify header information - headers already sent by (output started at /home/b/a/n/bankokash/www/test/newsphp/admin/index.php:9) in /home/b/a/n/bankokash/www/test/newsphp/admin/index.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /home/b/a/n/bankokash/www/test/newsphp/admin/index.php:9) in /home/b/a/n/bankokash/www/test/newsphp/admin/index.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /home/b/a/n/bankokash/www/test/newsphp/admin/index.php:9) in /home/b/a/n/bankokash/www/test/newsphp/admin/index.php on line 16
Je débute veuillez être indulgent :aie:
Lien vers le back office (lien admin) :http://bankocodes.fr/test/newsphp/index.php
Codes PHP:
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
|
<html>
<head>
<title>Acceuil admin</title>
</head>
<body>
<div align="center">
<a href="gestion.php">Gestions des news</a>||<a href="ajouter.php">ajouter news</a>||
<?php include('config.php');
$user = "admin";
$password = "test";
if(!($_SERVER['PHP_AUTH_USER']=="$user" && $_SERVER['PHP_AUTH_PW']=="$password")){
header("status: 401 Unauthorised");
header("HTTP/1.0 401 Unauthorized");
header('WWW-authenticate: Basic'.'realm="acces securise au back-office"');
print("mauvais pseudo ou mot de passe");
}
print("Bienvenue ".$pseudo);
?>
</div>
</body>
</html> |