I’m having a problem trying to keep a session when i send a AJAX called to a file in a sub directory. I figured it was a problem with session create intance in the cookie based on the sub directory so i did the Set Cookie Param.
CreateAccount.php
ini_set('session.cookie_domain', substr($_SERVER['SERVER_NAME'],strpos($_SERVER['SERVER_NAME'],"."),100));
session_set_cookie_params(0, '/', '.domain.com');
session_start();
$.ajax({
url: "/user_signup.php",
type: "post",
data: values,
success: function(){
window.location.reload(true); // Reloads the window to force the session to show in current page.
},
error:function(){
alert("failure");
}
});
It works perfect went i put the CreateAccount in the root directory… however just for my sanity (OCD Issues) i prefer the CreateAccount to go into /ajax/CreateAccount.php lol