2010-02-26 70 views
5

我必須下載任何文件才能在php中創建登錄表單。我問過這一百萬次,但林不知道你們是否得到了這個問題。我只想要一個登錄表單。在phpmyadmin中。其中您將輸入您的用戶名和密碼。我必須創建任何php登錄表單,或者當您安裝wampserver時它已經包含在內。我已經在C:\ wamp \ apps \ phpmyadmin3.2.0.1中配置了config.inc.php。 下面是我不包含任何密碼時的樣子。我需要編輯什麼?請給我一個初學者我很渴望擁有登錄表單,但我沒有得到任何相關答案。如何配置config.inc.php以在phpmyadmin中創建登錄表單

<?php 

    /* Servers configuration */ 
    $i = 0; 

    /* Server: localhost [1] */ 
    $i++; 
    $cfg['Servers'][$i]['verbose'] = 'localhost'; 
    $cfg['Servers'][$i]['host'] = 'localhost'; 
    $cfg['Servers'][$i]['port'] = ''; 
    $cfg['Servers'][$i]['socket'] = ''; 
    $cfg['Servers'][$i]['connect_type'] = 'tcp'; 
    $cfg['Servers'][$i]['extension'] = 'mysqli'; 
    $cfg['Servers'][$i]['auth_type'] = 'config'; 
    $cfg['Servers'][$i]['user'] = 'root'; 
    $cfg['Servers'][$i]['password'] = ''; 
    $cfg['Servers'][$i]['AllowNoPassword'] = true; 

    /* End of servers configuration */ 

    $cfg['DefaultLang'] = 'en-utf-8'; 
    $cfg['ServerDefault'] = 1; 
    $cfg['UploadDir'] = ''; 
    $cfg['SaveDir'] = ''; 

    ?> 

回答

16

首先,你沒有發展任何形式的自己:phpMyAdmin的,這取決於它的配置(即config.inc.php會顯示一個標識形式,它要求一個登錄名和密碼。

要獲得這種形式,你不應該使用:

$cfg['Servers'][$i]['auth_type'] = 'config'; 

但是,你應該使用:

$cfg['Servers'][$i]['auth_type'] = 'cookie'; 

(至少,這就是我有一個提示登錄的服務器上/密碼,使用表格)


欲瞭解更多信息,你可以看看文件心理狀態:

'config'認證($auth_type = 'config')是普通的老的方法:用戶名和口令被存儲在 配置。 inc.php。在2.2.3 介紹

'cookie' 認證模式($auth_type = 'cookie')允許您登錄與餅乾的幫助任何有效 MySQL用戶。
用戶名和密碼在會話期間被存儲在cookie中 和 密碼在結束時被刪除。

+0

感謝,這是我一直在尋找的答案。你是那個人! – user225269 2010-02-26 12:35:33

+0

不客氣:-) – 2010-02-26 12:37:47

2
$cfg['Servers'][$i]['auth_type'] = 'cookie'; 

應該工作。

the manual

AUTH_TYPE = '餅乾' 提示在友好的HTML形式的MySQL用戶名和密碼。這也是登錄到任意服務器的唯一方式(如果啓用了$ cfg ['AllowArbitraryServer'])。 Cookie適用於大多數安裝(在pma 3.1+中默認),它提供了配置上的安全性,並允許多個用戶使用相同的phpMyAdmin安裝。對於IIS用戶,Cookie通常比http更容易配置。

2
$cfg['Servers'][$i]['AllowNoPassword'] = false;