Authentification .htacces en php
smed_79
Messages postés
1793
Statut
Contributeur
-
smed_79 Messages postés 1793 Statut Contributeur -
smed_79 Messages postés 1793 Statut Contributeur -
Bonjour,
le code ne fonctionne pas chez moi ! pourquoi ?
Merci
<?php
if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic entrer=\"Entrer dans la page\" ");
Header("HTTP/1.0 401 Unauthorized");
echo "Vous avez appuyé sur le bouton annuler!!!\n";
exit;
} else {
if ( ($PHP_AUTH_USER == "admin") && ( $PHP_AUTH_PW == "pass" ))
{
//pour rediriger apres verification du pass
header("location: http://localhost/site");
}
else
{
//si le passe et pas bon
echo "<html><body>Demandez à votre Administrateur ou Webmaster le mot de passe :P<P></body></html>";
}
}
?>
le code ne fonctionne pas chez moi ! pourquoi ?
Merci
A voir également:
- Authentification .htacces en php
- Double authentification google - Guide
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Code a 6 chiffres application d'authentification instagram - Forum Instagram
- Php alert ✓ - Forum PHP
<?php if ( !isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($_SERVER['PHP_AUTH_USER'] !== "user" ) || ($_SERVER['PHP_AUTH_PW'] !== "pass") ) { header('WWW-Authenticate: Basic realm="Login"'); header('HTTP/1.0 401 Unauthorized'); echo '<html><head>'; echo '<title>Protected Object</title></head><body>'; echo '<h1>Protected Object</h1>'; echo 'Access Denied This object on the RomPager server is protected'; echo '</body></html>'; exit; } echo 'Login ok !'; ?>@++