JOOMLA 後台無法登入

列印

  今天在將PHP.INI的安全設置完成時,要到JOOMLA後台,發現一直無法登入,我原本還以為被入侵改密碼了,因此進入資料庫查看,但發現沒有事情,因此我在想該不會我忘了密碼,因此我用以下程式將我的管理者重設為admin,密碼也設為admin.

/**
 * $Id: pwreset.php 1 2008-09-30 03:21:48Z uwalter $
 * pwreset is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

define('USERNAME', 'admin');

// Set flag that this is a parent file
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);

require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
require_once JPATH_BASE.DS.'includes'.DS.'framework.php';

$mainframe =& JFactory::getApplication('administrator');
$database  =& JFactory::getDBO();

$database->setQuery("
UPDATE #__users SET
password = 'd017b046edaf5c81395a53d645757fc3:QPPTc7sUJAbaykBU0KV87BtDgdGCl5EZ'
WHERE username = '".USERNAME."'
");

$database->query();
echo 'Password reset for user ', USERNAME,
     ($database->getAffectedRows() === 1) ? ' succeeded.' : ' failed.';
?>

  要使用此程式碼, 請複製貼到記事本,然後另存成repw.php然後放置網站的根目錄,接者啟動他,更新完後將他刪除.

  然而當我用完後,還是登入不進去,我想說重新安裝看看,結果開始安裝就出Cookies在您的瀏覽器中被關閉執行。沒有這項功能您無法安裝程式。我心想不對阿我COOKIE都有啟動阿,我接下來去檢查我的PHP.INI,然後去檢查以下兩個路徑的位置:

   session.save_path = "/tmp/php" ;
   session.cookie_path = "/tmp/cookie";

  這個時候我上網去查詢 session.cookie_path才發現我會錯他的意了,session.cookie_path他指的不是COOKIE存放的位置,而是COOKIE有效的位置,跟session.save_path所代表的含意是不同的.

  我之後將 session.cookie_path = "/tmp/cookie";改成session.cookie_path = /;就正常了.