PDA

View Full Version : needed refer script


vkidv
09-28-2002, 12:52 PM
i have the gatekeeper script which simply protects a small site... ( not that important)

how can i make the 'refering (must come from script)' work with gatekeeper - as gatekeeper dose not use a link, it uses window.location somthing...

heres a site map:

Page 1 // Click here on link and gatekeeper opens.
Page 2 // (password, the gatekeeper thing) type password here.
page 3 // simply protected page. (by gate keeper)

how can i get page 3 only to work if it is refered by maybe page 2....


the must refered from will stop 'average' people (with java enabled) getting to the basically protected site........

im confused with this myself

i hope ive made it clear and understandable

A1ien51
09-28-2002, 03:03 PM
This forums is meant to post scripts, not ask for them. It will be moved to the right forum as soon as a mod stops by

jamescover
09-29-2002, 02:08 AM
Give this a shot:


<script>
<!--
href=window.location.href;
any_variable=href.substring(href.lastIndexOf('/')+1);
function getPage(){
if (any_variable=="AddressOfValidReferrerPage.html"){
window.location.href="YourAuthorizedPage.html";
}
else{
window.location.href="YourUnauthorizedPage.html";
}
}
getPage();
//-->
</script>


James
He is risen!!!

glenngv
09-30-2002, 06:33 AM
//in page 3
if (document.referrer!="http://yourdomain/page2.htm")//must be full path
location.href="page1.htm";

remember referrer property only works when online.