PHPã ãã§Basicèªè¨¼
ä½ãã®æåã§ä½¿ããªãã¨ãéããªãã®ã§ã¡ã¢ä»£ããã«æ¸ãã¦ããããã£ããã¨æµãã ãã
<?php if (!authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { header('WWW-Authenticate: Basic realm="title here"'); header('HTTP/1.1 401 Unauthorized'); echo 'Authentication failure.'; exit; } function authenticate($user, $password) { return ($user === VALID_USER && md5($password) === VALID_PASSWORD); } ?>
authenticateé¢æ°ã®é¨åã§ãã¼ã¿ãã¼ã¹ã¢ã¯ã»ã¹ããããã«ããã°ããã¼ã¿ãã¼ã¹ãç¨ããèªè¨¼æ©è½ãä½ãããããã以åä½ã£ããµã¤ãã§ç°¡æçãªèªè¨¼ã¨ãã¦ä½¿ã£ããã¨ãããã
Digestèªè¨¼ãªã©ãå«ããè¨è¿°ãPHPマニュアルにあるã®ã§ãã¡ããåèã«ã
â»追記として補足を書いたã®ã§ãããããã°ã©ããã