ラフな部分しか作っていないので、あと細かい部分は好きにしてください。
これ以外にはにユーザ定義の後ろに次の行を加えます。 ちなみに、私の所では大量の$auth_usersのみを記述したpassword.ini.phpと いうファイルを作り、この直後に読み込んでいます。
pukiwiki.ini.php ///////////////////////////////////////////////// // 登録者認証 (TRUE: 認証が必要 FALSE:不必要) // $register_only=TRUE;
lib/auth.php 5c5 < // $Id: auth.php,v 1.1 2004/10/05 03:00:26 root Exp root $ --- > // $Id: auth.php,v 1.1 2004/08/01 01:54:35 henoheno Exp $ 36a37,42 > > global $register_only; > if ( $register_only and !register_auth()) { > return FALSE; > } > 122a129,169 > > // 登録者認証 > function register_auth() > { > global $auth_users; > > if (!isset($_SERVER['PHP_AUTH_USER']) > or $auth_users[$_SERVER['PHP_AUTH_USER']] == "" ) { > //セットされていない時、尋ねる > header('WWW-Authenticate: Basic realm="'.$_msg_auth.'"'); > header('HTTP/1.0 401 Unauthorized'); > register_auth_failed(); > exit; > } > else { > // 一応いるようなのでパスワードをチェック > if ( $auth_users[$_SERVER['PHP_AUTH_USER']] != $_SERVER['PHP_AUTH_PW']) { > //パスワードちがうじゃん > register_auth_failed(); > exit; > } > // 無事認証 > return TRUE; > } > } > // 認証できなかった > function register_auth_failed() { > print <<<EOD > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>HTTP/1.0 401 Unauthorized</title> > <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> > </head> > <body> > <h1>HTTP/1.0 401 Unauthorized</h1> > </body> > </html> > EOD; > } >
function check_readable($page,$auth_flag=TRUE,$exit_flag=TRUE) { return read_auth($page,$auth_flag,$exit_flag); }
// pukiwiki.ini.php $read_auth_pages = array( '#.#' => 'valid-user', // Reserved 'valid-user' group that contains all authenticated users );