• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

Web site access only via another web site first

Status
Not open for further replies.
Joined
Dec 30, 2006
Posts
1,749
Reaction score
75
Two web sites, Site-A & Site-B.

Does anyone know a way to ensure that access to Site-A is only possible via Site B? I'm thinking this may be a combination of htaccess and robots files here, but i need advice on the best way to do it.

Cheers!
 
place this in the header of site B:

<?php
if(!eregi('sitea\.co.uk', $HTTP_REFERER)){
die("You don't have access to this site");
}
?>
 
place this in the header of site B:

<?php
if(!eregi('sitea\.co.uk', $HTTP_REFERER)){
die("You don't have access to this site");
}
?>

That will work, although on PHP installations with register globals off (which will be most) you'll need to use $_SERVER["HTTP_REFERER"]

However, HTTP_REFERER is very easily spoofed, so this isn't suitable if you require any sort of security or certainty.
 
You could do it with an ACL as previously suggested. A two (or more) part key such as [ip address + session id], [http referrer + ip address], [etc...] should be enough to complete the task.

Alternatively you could issue a single use URL to the resource on server b and expire the link [token] after it has been clicked 1..* times and/or after a set time period has elapsed.

Code:
e.g http://www.server-b.tld/resource?token=6332757058575

In this use case you don't care where the user came from only that the resource is constrained by the business rules associated with the token.
 
Status
Not open for further replies.
Top Bottom