Auth_HTTP 例 (Previous) (Next) Auth_HTTP::getAuth()

View this page in Last updated: Sun, 31 Aug 2008
English | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Plain HTML

Auth_HTTP 例2

Auth_HTTP 例2 -- データベースからの列データの取得と MD5 パスワード使用の例


<?php  
// データベースからの列データの取得と MD5 パスワードを使用した例

require_once("Auth/HTTP.php");

// データベース接続オプションの設定
$AuthOptions = array(
'dsn'=>"pgsql://test:test@localhost/testdb",
'table'=>"testable",                            // テーブル名 
'usernamecol'=>"username",            // ユーザ名のコラム
'passwordcol'=>"password",            // パスワードのコラム
'cryptType'=>"md5",                // データベース中でのパスワードの暗号化形式
'dbFields'=>"*",                // 他のコラムの取得を可能にする
);


$a = new Auth_HTTP("DB"$AuthOptions);

$a->setRealm('yourrealm');            // 領域 (realm) 名
$a->setCancelText('<h2>Error 401</h2>');        // 認証が失敗した際に表示されるメッセージ
$a->start();                    // 認証プロセスの開始


if($a->getAuth())                // 認証すべきユーザかどうかの確認 
{
    echo "Hello $a->username welcome to my secret page <BR>";
    echo "Your details on file are: <BR>";
    echo $a->getAuthData('userid');        // データベースから他のデータを取得している。
    echo $a->getAuthData('telephone');      // この例では、ユーザID (userid)、電話番号 (telephone)
    echo $a->getAuthData('email');        // およびメールアドレス (email) を取得。
};
?>

Auth_HTTP 例 (Previous) (Next) Auth_HTTP::getAuth()

Download Documentation Last updated: Sun, 31 Aug 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.