Friday, 10 May 2019

Laravel 5 - Recover SESSION for PGRFileManager.php

Please, with my PGRFileManager.php (with my ckeditor),
The visitors can unfortunately access to file to this adress :
http://my-web-site.com/ckeditor/plugins/pgrfilemanager/PGRFileManager.php




To secure I want to ensure that if it is not a user of my admin, redirect (exit) the visitor ...



At Login I create a new SESSION "usercms" :





public function postLogin(Request $request)
{
$login = Auth::attempt([

'username' => $request->input('username'),
'password' => $request->input('password')
], $request->input('remember'));

if ($login) {
Session::put('usercms', 'EXISTE'); // CREATE SESSION
...
}
}






OK.
_But the prolem, in my PGRFileManager.php, with this code :

session_start();
var_dump($_SESSION['usercms']);





Wamp return this error :
"Notice: Undefined index: usercms in C:\wamp\www___Laravel\my-web-site\ckeditor\plugins\pgrfilemanager\PGRFileManager.php on line 4"



What is the solution please?
Thank You.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...