简体   繁体   中英

login url session rewrite

I have an issue with login session. Basically the flow is like this:

  • user creates account and defines a username;
  • user logins using url 'http://[username].website.com'
  • (coded in php & mysql, using session cookie)

My problem is: when trying to directly login from the index page 'www.website.com' I don't manage to get my user logged to his URL http://username.website.com

/// EDIT ///

Let say i have opened url "www.example.com" and created a session variable in this url. Now i want to access that session variable in url "test.example.com". How to do that? any solution welcomed

/// EDIT2 ///

In the top of every php file i have used the below code but my session variable was destroyed and i can't access the session variable in another page. I have also set session.cookie_domain = ".website.com" on "php.ini" file.

ini_set('session.cookie_domain', '.website.com');

session_name("sessionid"); session_start();

As minaz mentioned in the comments, make sure that the cookie you're setting on www.website.com is valid for domain-matching on ".website.com".

If you're still not sure whats happening, try playing around with wget (http://www.gnu.org/software/wget/) using --save-cookies, --load-cookies and --debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM