Jump to content

SESSION across subdomain


Kaboom

Recommended Posts

Because my entire script is coded around a session right now I don't want to convert everything to cookies because, as I have tried before, I always fail and it doesn't work regardless. Now we have two seperate places but the session won't stick, even when using the .htaccess thing. We have http://secure.stephanddarryn.com/www/login/ and it works and holds a session, IN SECURE but wont from http://secure.stephanddarryn.com/www/login/ to http://www.stephanddarryn.com/ for them to browse, which it is supposed to do. the subdomains make it look more professional but it won't hold, how can I fix this?

 

 

EDIT: we were using "ini_set("session.cookie_domain", ".stephanddarryn.com");" but isnt working since not using cookies

Link to comment
Share on other sites

Then your session id IS being propagated between pages by the browser using a cookie and in order for it to match all variations of your domain, you will need to get the ini_set("session.cookie_domain", ".stephanddarryn.com"); to work.

 

You must set the session.cookie_domain before every session_start() statement. It is best to globally set it in the master php.ini (when you have access to the master php.ini), in a local php,ini (when php is running as a CGI application), in a .htaccess file (when php is running as an Apache Module), or finally in your script if you don't have access to any of the other methods.

Link to comment
Share on other sites

Have you done anything to troubleshoot if the session id has the same value on the www. page that it has on the page where it was set? For all we can tell, you don't have a session_start() statement on the www. page and the session does not exist or you are changing the path of the page and the session.cookie_path is not set to '/' so that it would match any path other then where the session id cookie is being set.

Link to comment
Share on other sites

No like login.php and index.php where in the same folder at one point in time. Ex:

 

/home/user/public_html/www/

 

I then moved my login file to a new folder and renamed it to be the default in that folder. Ex:

 

/home/user/public_html/secure/www/login/

 

For some reason now that it's in it's own subdomain the login script is not storing the session for my domain even with the code for php.session_domain and cookies at .stephanddarryn.com. For some odd reason it won't actually log you in anymore and I can't for the life of me get it to stay. Get what I mean? I'll try another thing and see if it works.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.