Forum Moderators: coopster
if(!is_dir("sessions")) {mkdir("sessions", 0777);}
session_set_cookie_params(315360000, "/");
session_save_path("sessions");
session_start();
And this on a page in a subfolder:
if(!is_dir("../sessions")) {mkdir("../sessions", 0777);}
session_set_cookie_params(315360000, "/");
session_save_path("../sessions");
session_start();
For some reason the session vanishes if I go to a page in the subfolder. When I log in on my main page, I should be able to go to scripts in the subfolder. I checked my sessions folder and the main page seems to work correctly (creates a session file and adds data to it). However, when I go to a page in the subfolder, PHP created a new session file in that folder which is empty. Also, when I move that file to the document root (where my main file also is located) the script works (after changing the paths of course).
Does anyonw know how to solve this? There are about 20 scripts inside that subfolder so it becomes quite a mess if I would move them all to the document root.
Thanks in advance
Stefan