0
我嘗試將CKFinder
包含在我的PHP網站上。我發現官方的文檔:如何使用SESSION安全性將CKFinder2添加到php頁面?
<?php
$_SESSION['IsAuthorized'] = TRUE; // simple user authorized
$finder = new \CKFinder();
$finder->BasePath = 'http://bow.loc/web/libs/ckfinder2/';
$finder->Create();
但它工作,我需要在config.php
文件的變化:
<?php
session_start();
/**
* This function must check the user session to be sure that he/she is
* authorized to upload and access files in the File Browser.
*
* @return boolean
*/
function CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
// return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
// ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
// user logs in your system. To be able to use session variables don't
// forget to add session_start() at the top of this file.
return FALSE;
}
// other code...
而且我不希望出於安全原因,簡單地return TRUE
,我想使用會話。但問題是我不能這樣做,因爲$finder->Create();
方法直接返回在IFRAME ckfinder.html
頁面中打開的HTML代碼,所以在我的框架中的會話和CKFinder中的會話不同,並且return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
返回FALSE
!所以我的問題是:
如何將會話與用戶身份驗證從我的框架傳遞到CKFinder並對授權用戶進行安全驗證?非常感謝您的幫助!
會可能有助於瞭解您正在使用的框架。 – kevindeleon
你在config.php上使用session_start()? – gabrieloliveira
@gabrieloliveira是的,我在'config.php'的頂部添加'session_start()' –