This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 25
25
ini_set ('session.httponly ' , true ); // Only allow http protocol (ie, not JS) access to the cookie
26
26
ini_set ('session.cookie_httponly ' , true ); // Only allow cookie via http protocol (ie, not JS) access to the cookie
27
27
// ini_set('session.save_path', dirname(__FILE__) . '/../tmp'); // Localise the session files to /tmp
28
- if (false === isset ($ _COOKIE ['ICEcoder ' ])) {
29
- $ _COOKIE ['ICEcoder ' ] = session_create_id ();
30
- }
31
- session_id ($ _COOKIE ['ICEcoder ' ]);
32
28
29
+ if (false === isset ($ _COOKIE ['ICEcoder ' ])) {
30
+ // PHP v7.1+
31
+ if (function_exists ('session_create_id ' )) {
32
+ $ _COOKIE ['ICEcoder ' ] = session_create_id ();
33
+ session_id ($ _COOKIE ['ICEcoder ' ]);
34
+ // PHP v7.0 fallback
35
+ } else {
36
+ session_start ();
37
+ $ _COOKIE ['ICEcoder ' ] = session_id ();
38
+ }
39
+ }
33
40
if (!empty ($ _SERVER ['HTTPS ' ]) && $ _SERVER ['HTTPS ' ] !== 'off ' ) {
34
41
ini_set ('session.cookie_secure ' , '1 ' ); // Only allows access to session ID when protocol is HTTPS, switched on under 'if https' condition
35
42
}
36
- session_start (); // Finally, start the session!
43
+ if (false === isset ($ _SESSION )) {
44
+ session_start ();
45
+ }
37
46
if (false === isset ($ _SESSION ['csrf ' ])){
38
47
session_regenerate_id (true ); // Create a new ID to help prevent fixation & hijacking
39
48
$ _COOKIE ['ICEcoder ' ] = session_id ();
You can’t perform that action at this time.
0 commit comments