CodeIgniter Forums
Can not use session out slide application folder in CI 3.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Can not use session out slide application folder in CI 3.0 (/thread-61385.html)



Can not use session out slide application folder in CI 3.0 - nutt198 - 04-12-2015

I have problem with CI 3.0 to use session outside application folder for Ckfinder and set authentication below but show error disable security reasons.


$sess = unserialize($_COOKIE['ci_session']);

if($sess['sess_xxxxxxx']!="xxxxx"){
return false;
}else{
return true;
}

I've tried with CI 3.0 Dev it working good. Thank you for answer in advance.


RE: Can not use session out slide application folder in CI 3.0 - gofrendi - 04-14-2015

I also have similar problem. Seems that in CI 3, $_SESSION is not an alias for native session.
Thus, $_SESSION in you CI application is different from "the real" $_SESSION.
I still don't get any idea how to solve this. Probably using $_COOKIE instead of $_SESSION will work. But I don't think it is save.


RE: Can not use session out slide application folder in CI 3.0 - ivantcholakov - 04-14-2015

Shortly before the final CI3 release the session library and its drivers have been replaced. Cookie-based session storage is not implemented intentionally.


RE: Can not use session out slide application folder in CI 3.0 - gofrendi - 04-14-2015

How about native session? http://forum.codeigniter.com/thread-61415.html


RE: Can not use session out slide application folder in CI 3.0 - ivantcholakov - 04-14-2015

I know the tricky answer. Maybe there is an easier way, but I don't know it.

For me I integrated long time ago a standalone file manager (KCFinder) in a way that works in any session driver. But there are two things to be done:

1. Some modification of the file manager's code is needed. Calling session_start() there is not good, CodeIgniter is to initialize the session.

2. How? I implemented loading CodeIgniter core in non-MVC way. The function get_instance() works, it returns a dummy controller with the usual properties, get_instance()->session and etc. And the loaded core initializes itself using the CodeIgniter settings, including the session settings. Thus, the external file manager uses the same session, created by CodeIgniter.

See how a demo non-MVC page looks like: https://github.com/ivantcholakov/starter-public-edition-3/blob/v3.0.2/www/non-mvc/demo.php

This is one of the entry files of the file manager - I create CodeIgniter's core there too: https://github.com/ivantcholakov/starter-public-edition-3/blob/v3.0.2/www/assets/kcfinder/browse.php

And then: https://github.com/ivantcholakov/starter-public-edition-3/blob/v3.0.2/www/assets/kcfinder/core/uploader.php#L123

3. The good side of such an integration is that the file manager's configuration settings also can be tweaked by CodeIgniter (depending on user credentials). For example, the file manager may be enabled for power users only, this is CodeIgniter to determine who is who.


RE: Can not use session out slide application folder in CI 3.0 - ivantcholakov - 04-14-2015

Concerning CKFinder, as far as I can see, it is not free software. The developers of CKFinder could have been created a common way how the file manager could be integrated to a MVC framework. Examine their source and documentation. Maybe you should ask a question at their forum.


RE: Can not use session out slide application folder in CI 3.0 - ircdirk - 04-22-2015

CKFinder != KCFinder


RE: Can not use session out slide application folder in CI 3.0 - InsiteFX - 04-22-2015

KCFinder is free software.


RE: Can not use session out slide application folder in CI 3.0 - chaegumi - 09-07-2015

$session_id = $_COOKIE['ci_session'];
$content = file_get_contents(dirname(__FILE__) . '/../../application/cache/ci_session/ci_session' . $session_id);
session_start();
session_decode($content);