※ 引述《jimshsu (jims)》之銘言:
: 依據你的建議
: 我找到這兩個檔
: config.inc.php user_password.php
: $cfg['Servers'][$i]['auth_type'] = 'config';
: // Authentication method (config, http or cookie based)?
: $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
: $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
: // with 'config' auth_type)
: 我搞不太清楚cookie跟http模式的差別
: 不知道是否有版友了解?
: 因為不同的帳號有不同的資料表
: 所以在我的案例預先寫好帳號密碼的config顯然不行
: 我現在問題是不知道要寫什麼變數到session或cookie讓myadmin直接可以針測到變數
: 因為phpMyAdmin在http的登入方式~~到底登入後
: 在各個操作頁面~~他是如何確認使用者的登入狀態?~
: 這點我還搞不懂~~XD
: 若有其他建議~~請多指教
: 謝謝
※ 編輯: Jun1004 來自: 203.95.196.252 (01/11 11:16)
phpmyadmin 頁面都有 include common.lib.php
require_once('./libraries/common.lib.php');
common.lib.php 依照你的設定的 auth_type 去讀取不同的lib
require_once './libraries/auth/'.$cfg['Server']['auth_type'].'.auth.lib.php';
登入狀態有四個 function
PMA_auth_check : Gets advanced authentication settings
PMA_auth : Displays authentication form
PMA_auth_set_user : Set the user and password after last checkings if required
PMA_auth_fails : User is not allowed to login to MySQL -> authentication
failed
在 phpmyadmin/libraries/auth 資料夾下有三支php,分別是config、cookie、http
config.auth.lib.php
cookie.auth.lib.php
http.auth.lib.php
cookie的方式是第一次打帳號密碼後資料存在cookie,下次不用再打,
cookie清掉後就要在打帳號密碼
http的方式是每次都會驗證帳號密碼
如果你想要用phpmyadmin的login驗證方式,很簡單,只要include common.lib.php
<?php
require_once('./libraries/common.lib.php');
echo "test";
?>