hackalive Posted April 8, 2012 Share Posted April 8, 2012 Ive put together a PHP/MySQLi login script for my site. However I was wandering: 1. Does Facebook use PHP Cookies or Sessions for their login? (Figured out my own answer ) 2. How does FB set the Cookie/Session so that when I log into facebook.com I am also logged into developers.facebook.com Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/260562-login-authentication/ Share on other sites More sharing options...
dcro2 Posted April 8, 2012 Share Posted April 8, 2012 If you assign a cookie with the domain .domain.com (or just domain.com) it should be sent to any subdomain as well. Just make sure to set the path as / or something that fits all subdomains you want. See session_set_cookie_params. Quote Link to comment https://forums.phpfreaks.com/topic/260562-login-authentication/#findComment-1335382 Share on other sites More sharing options...
hackalive Posted April 8, 2012 Author Share Posted April 8, 2012 So when setting the cookie id set it as ".mydomain.com" or "/"? Quote Link to comment https://forums.phpfreaks.com/topic/260562-login-authentication/#findComment-1335383 Share on other sites More sharing options...
dcro2 Posted April 8, 2012 Share Posted April 8, 2012 A cookie has both a domain and a path. If you set a cookie's domain to "domain.com", you will also see it on "sub.domain.com" but only if its path matches the URL. So set the domain as ".mydomain.com" and the path as "/", which means any path on any subdomain. They're two different things that work together. Quote Link to comment https://forums.phpfreaks.com/topic/260562-login-authentication/#findComment-1335384 Share on other sites More sharing options...
hackalive Posted April 8, 2012 Author Share Posted April 8, 2012 okay, many thanks Quote Link to comment https://forums.phpfreaks.com/topic/260562-login-authentication/#findComment-1335385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.