session id has overwrite when i refresh sub-domain site |
[eluser]guzzilar[/eluser]
Hi ci forum sorry my english language is not good... ----- My site has 2 application in main-domain & sub-domain application in sub-domain use CI version 1.7.2 and application in main-domain user CI version 2.1.0 and session is overwrite when i refresh in sub-domain and main-domain I tested via in sub.site.com & www.site.com Code: function test_sess() in my config.php of sub.site.com Code: $config['encryption_key'] = 'my_'; and config.php in site.com Code: $config['encryption_key'] = 'my_'; Sorry but help me please , I want to fix session_id in 2 site (sub.site.com ,www.site.com) for check login session in database Thank.
[eluser]InsiteFX[/eluser]
If the database session is store in the same table for both domains then thats your problem. Each domain should have it's sess_cookie_name and sess_table_name different and each should have its own session table with a different name if running on the same database.
[eluser]guzzilar[/eluser]
[quote author="InsiteFX" date="1342089504"]If the database session is store in the same table for both domains then thats your problem. Each domain should have it's sess_cookie_name and sess_table_name different and each should have its own session table with a different name if running on the same database. [/quote] Thank's for your suggestion but, when i checked session in both domain i don't store it into database , i use $this->session->userdata('session_id'); for check session id (check by refresh page in both domain toggle) and result is First refresh: www.site.com >> e9687814977f4fe4286afa863337677d Second refresh: sub.site.com >> 3bbed7255c4bc02880a0965133d60108 Third refresh: www.site.com >> 9a40d5e6923b6cf9921aa3598e8e8940 and if i use different db name for store session id , how i check session login? ------------------------------- Thank for reply me hahaha
[eluser]InsiteFX[/eluser]
Everytime you refresh a web page the session will regenerate a new session_id Use a different session userdata field. So as you can see checking the session_id is useless in this case.
[eluser]guzzilar[/eluser]
[quote author="InsiteFX" date="1342098857"]Everytime you refresh a web page the session will regenerate a new session_id Use a different session userdata field. So as you can see checking the session_id is useless in this case. [/quote] Sorry i don't understand. how can i check login session in this case. I tried use other session to check it in site.com (main-domain) exam : Code: $this->session->set_userdata('member' ,'yes'); but in sub.site.com (sub-domain) session 'member' is not appear and when i use php function Code: print_r($this->session->userdata); i get userdata session array Array ( [session_id] => a0bb64e596c072d9e271e80977059168 [ip_address] => xxx.xxx.xx.xx [user_agent] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (K [last_activity] => 1342099551 ) What userdata session can i should. Thank again for your reply // I noob for session & cookie LOL
[eluser]InsiteFX[/eluser]
Set a cookie and pass the login through a cookie you should be able to read the cookie. Either that or store it in the database and read it back.
[eluser]guzzilar[/eluser]
Alright! ,It's ok. i use cookie "isLogin" for check . i try coding in site.com Code: function test_sess() and in sub.site.com is Code: function test_sess() and ok it's echo "yes" in both domain hahaha (I think it's ok) Thank's very much and sorry for my english language skill hahaha |
Welcome Guest, Not a member yet? Register Sign In |