I have a website with a user database and a login form. This system has worked 100% flawlessly. I have a main site with the name= www.example.com
and a subdomain called accounts.example.com
. When a user logs in, he or she logs in on the main site, www.example.com/login.php
.
To view their profile and make edits, they click a link that takes them to accounts.example.com/profile.php?user=theirusername
. When the page loads, an edit button is suppose to show if they are viewing their own account. I go about doing this like so, <?php if($user == $dbusername){
echo"<a href='edit.php'>EDIT</a>";}
. This feature works fine if I go to www.example.com/Accounts/profile.php?user=theirusername
, but on the subdomain it doesn't work. The accounts.example.com
points to the same path that www.example.com/Account/
does.
I have no clue why this is happening and I'm using the standard php SESSIONS. When I look inside the Cookies tab in the Safari Inspector it shows 1 SESSION, accounts.example.com
.
Is there a way to "carry" a cookie to another sub domain? Any help would be great! Thanks!