Jump to content

[SOLVED] Quick question


adamjones

Recommended Posts

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.

Link to comment
Share on other sites

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..?

Link to comment
Share on other sites

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...

 

 

Link to comment
Share on other sites

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.

:(

Link to comment
Share on other sites

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....

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.