adamjones Posted February 21, 2009 Share Posted February 21, 2009 I have a subdomain for an administration panel on my website. The idea is the user logs in on the normal website, and if they type in the subdomain, they will be directed to the admin panel. On the admin panel, it checks if the user is logged in, and if not directs them back to the website. If they are logged in, it checks their rank, and if their rank is over 1, it allows them access. Only problem I'm having is related to sessions I think. If I'm logged in, and go to the admin panel, using the subdomain, it just directs me to the website, as if I wasn't even logged in. But, if I go to the real URL of the admin panel, instead of the subdomin, it works perfectly?.. Hmm.. Here is the code for my admin panel; <?php session_start(); if(!session_is_registered(name)){ header("location:http://www.mysiteblahblah.co.uk"); } { if($_SESSION['rank'] > 0){ header("location:admin.php"); } else { header("location:http://www.mysiteblahblah.co.uk"); } } ?> Eg: www.mysite.com/secure/house-keeping/index.php will work... www.subdomain.mysite.com wont. Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 21, 2009 Share Posted February 21, 2009 Ok well I'm about to sound really wrong on this, but I don't think your sessions can cross domains. For example: www.mydomain.website.com and www.website.com They are both 2 different domains..... Quote Link to comment Share on other sites More sharing options...
adamjones Posted February 21, 2009 Author Share Posted February 21, 2009 Ok well I'm about to sound really wrong on this, but I don't think your sessions can cross domains. For example: www.mydomain.website.com and www.website.com They are both 2 different domains..... But it's the same website, the subdomain is just a redirect to the same website, just /secure/blahblah Hmm..? Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 21, 2009 Share Posted February 21, 2009 Well you can test this out easily. Run the same program/website and instead of using your subdomain, just make it a regular path on your server like: www.mywebsite.com/admin www.mywebsite.com/somethingelse If your code works that way, then we can probably say it's a subdomain thing... Again, I could be way off though... Quote Link to comment Share on other sites More sharing options...
adamjones Posted February 21, 2009 Author Share Posted February 21, 2009 Well you can test this out easily. Run the same program/website and instead of using your subdomain, just make it a regular path on your server like: www.mywebsite.com/admin www.mywebsite.com/somethingelse If your code works that way, then we can probably say it's a subdomain thing... Again, I could be way off though... Done, it works perfectly. Thank's for your help. Guess I'll just have to wave goodbye to my subdomain. Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 21, 2009 Share Posted February 21, 2009 Well you can test this out easily. Run the same program/website and instead of using your subdomain, just make it a regular path on your server like: www.mywebsite.com/admin www.mywebsite.com/somethingelse If your code works that way, then we can probably say it's a subdomain thing... Again, I could be way off though... Done, it works perfectly. Thank's for your help. Guess I'll just have to wave goodbye to my subdomain. Wow I was actually right? LOL.... Quote Link to comment 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.