Jump to content

Session & subdomain


phpmash

Recommended Posts

Presently i have a site mysite.com
In the home page users can login.
So I want to use a SESSION variable to store his login name and want to redirect him to user.mysite.com.
But the session variable is not available in subdomin user.mysite.com
In my server php.ini is not available.
So i expect a solution thru coding(ie not using configuration file php.ini)

Presently the problem is encountered in Firefox not in IE

Thanks

phpmash
Link to comment
Share on other sites

If the sub-domain is on the same server, you don't need to go through the trouble of having to save sessions in a DB (although I like to do that).

You can start by trying this:

Set the [a href=\"http://us2.php.net/session#ini.session.cookie-domain\" target=\"_blank\"]'session.cookie_domain'[/a] to '.mysite.com'. Notice there's a dot before the domain name. This allows the session cookie to be used at www.mysite.com or anysubdomain.mysite.com.

You can use [a href=\"http://us2.php.net/manual/en/function.ini-set.php\" target=\"_blank\"]ini_set()[/a] or [a href=\"http://us2.php.net/manual/en/function.session-set-cookie-params.php\" target=\"_blank\"]session_set_cookie_params()[/a] to set it.

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.