groups

name language licence
PHP: manipuler date Other Other
PHP : conversion type de variable PHP Other
PHP/MYSQL : inserer une date dans mysql Other Other
PHP/JS : convertir en int Other Other
JOOMLA : exemple de gabarit (index.php) Other Other
PHP : Authentification HTTP basique Other Other

< 1 2 3 4 5 >



language: Other
licence: Other

PHP : Authentification HTTP basique

options: view full snippetsend to code collector
Example #1 Basic HTTP Authentication example
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Text to send if user hits Cancel button';
    exit;
} else {
    echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
    echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
	
(Continues...)