source: temp/trunk/html/test/kakinaka/auth_http.php @ 10068

Revision 10068, 1.3 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php 
2// ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¤ÎÎó¥Ç¡¼¥¿¤Î¼èÆÀ¤È MD5 ¥Ñ¥¹¥ï¡¼¥É¤ò»ÈÍѤ·¤¿Îã
3require_once("../../require.php");
4$include_dir = realpath(dirname( __FILE__));
5require_once($include_dir . "/pear/Auth_HTTP.php");
6
7define("DSN", "pgsql://test_db_user:[email protected]/test_db");
8
9// ¥Ç¡¼¥¿¥Ù¡¼¥¹Àܳ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê
10$AuthOptions = array(
11'dsn'=>DSN,
12'table'=>"dtb_member",                            // ¥Æ¡¼¥Ö¥ë̾
13'usernamecol'=>"login_id",          // ¥æ¡¼¥¶Ì¾¤Î¥³¥é¥à
14'passwordcol'=>"password",          // ¥Ñ¥¹¥ï¡¼¥É¤Î¥³¥é¥à
15'cryptType'=>"none",                // ¥Ç¡¼¥¿¥Ù¡¼¥¹Ãæ¤Ç¤Î¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½·Á¼°
16//'cryptType'=>"none",              // ¥Ç¡¼¥¿¥Ù¡¼¥¹Ãæ¤Ç¤Î¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½·Á¼°
17'dbFields'=>"*",                // ¾¤Î¥³¥é¥à¤Î¼èÆÀ¤ò²Äǽ¤Ë¤¹¤ë
18);
19
20$a = new Auth_HTTP("DB", $AuthOptions);
21
22$a->setRealm('yourrealm');          // Îΰè (realm) ̾
23$a->setCancelText('<h2>Error 401</h2>');        // ǧ¾Ú¤¬¼ºÇÔ¤·¤¿ºÝ¤Ëɽ¼¨¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸
24$a->start();                    // ǧ¾Ú¥×¥í¥»¥¹¤Î³«»Ï
25
26if($a->getAuth())               // ǧ¾Ú¤¹¤Ù¤­¥æ¡¼¥¶¤«¤É¤¦¤«¤Î³Îǧ
27{
28    echo "Hello $a->username welcome to my secret page <BR>";
29    echo "Your details on file are: <BR>";
30    echo $a->getAuthData('userid');     // ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¤Î¥Ç¡¼¥¿¤ò¼èÆÀ¤·¤Æ¤¤¤ë¡£
31    echo $a->getAuthData('telephone');      // ¤³¤ÎÎã¤Ç¤Ï¡¢¥æ¡¼¥¶ID (userid)¡¢ÅÅÏÃÈÖ¹æ (telephone)
32    echo $a->getAuthData('email');      // ¤ª¤è¤Ó¥á¡¼¥ë¥¢¥É¥ì¥¹ (email) ¤ò¼èÆÀ¡£
33};
34
35
36?>
Note: See TracBrowser for help on using the repository browser.