Hello, I am struggling with this problem.
I wrote some code with an authentication routine. When a user is logged in $SESSION['auth'] is set to seomthing and when no user is authenticated $SESSION['auth'] does not exist.
I now installed CKEditor and CKFinder on my server to make the text input prettier and easier for my authenticated users.
The problem is that CKFinder needs to check for authentication and that is where I am struggling.
In the /ckfinder/config.php file there is this:
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'];
//... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
//user logs in your system.
return false;
}
If I simply set 'return true;' then CKFinder works but anyone can hack into the site and delete files uploaded by my authenticated users.
What I attempted to do is this:
function CheckAuthentication()
{
global $_SESSION;
if ( isset($_SESSION['auth']) )
return true;
else
return false;
}
but I keep not being being authenticated by CKFinder.
What am I doing wrong?
Can I not use a session variable in a third-party script on the same server? Isn't the session variable available server-wide? I don't understand...
Thanks for pointing me in the right direction.