(Created page with '== Enabling sessions == It is quite possible, that you'll use session variables in the configuration file (config.php), for example when setting up the [[CKFinder_2.x/Developers…') |
(Missing code formatting added) |
||
Line 1: | Line 1: | ||
== Enabling sessions == | == Enabling sessions == | ||
− | It is quite possible | + | It is quite possible that you will use session variables in the configuration file (<code>config.php</code>), for example when setting up the [[CKFinder_2.x/Developers_Guide/PHP/Configuration/Access_Control|Access Control]] or writing the [[CKFinder_2.x/Developers_Guide/PHP/Configuration/Quick_Start|CheckAuthentication()]] function. |
− | Please remember that you have to start your session before use of $_SESSION becomes available. | + | Please remember that you have to start your session before use of <code>$_SESSION</code> becomes available. |
− | In most cases it can be done by uncommenting the | + | In most cases it can be done by uncommenting the <code>session_start()</code> call in the configuration file: |
<pre> | <pre> | ||
session_start(); | session_start(); | ||
</pre> | </pre> | ||
− | Once enabled, session variables can be accessed using the global $_SESSION array: | + | Once enabled, session variables can be accessed using the global <code>$_SESSION</code> array: |
<pre> | <pre> | ||
$_SESSION['CKFinder_UserRole'] = "admin"; | $_SESSION['CKFinder_UserRole'] = "admin"; | ||
</pre> | </pre> | ||
− | Please do not call session_start() in the [[CKFinder_2.x/Developers_Guide/PHP/Configuration/Quick_Start|CheckAuthentication()]] function body, it is recommended to call session_start() at the beginning of config.php instead. | + | Please do not call <code>session_start()</code> in the [[CKFinder_2.x/Developers_Guide/PHP/Configuration/Quick_Start|CheckAuthentication()]] function body, it is recommended to call <code>session_start()</code> at the beginning of <code>config.php</code> instead. |
More information about session handling can be found in [http://php.net/manual/en/ref.session.php PHP manual]. | More information about session handling can be found in [http://php.net/manual/en/ref.session.php PHP manual]. |
Latest revision as of 06:27, 20 May 2015
Enabling sessions
It is quite possible that you will use session variables in the configuration file (config.php
), for example when setting up the Access Control or writing the CheckAuthentication() function.
Please remember that you have to start your session before use of $_SESSION
becomes available.
In most cases it can be done by uncommenting the session_start()
call in the configuration file:
session_start();
Once enabled, session variables can be accessed using the global $_SESSION
array:
$_SESSION['CKFinder_UserRole'] = "admin";
Please do not call session_start()
in the CheckAuthentication() function body, it is recommended to call session_start()
at the beginning of config.php
instead.
More information about session handling can be found in PHP manual.