TinMan
02-23-2003, 09:19 PM
Have tried this script on a site I have,
<script>
<!--
/*Referrer Checker- By JavaScript Kit
(www.javascriptkit.com) Over 200+ free JavaScripts here!
*/
//specify valid referrals for script to accept
//if you wish an entire domain to be valid, enter that (ie: "javascriptkit.com")
var validreferrals=new Array()
validreferrals[0]="http://www.javascriptkit.com/script/cut170.shtml"
validreferrals[1]="http://javascriptkit.com/script/cut170.shtml"
var passed=0
for (r=0;r<validreferrals.length;r++){
if (document.referrer.indexOf(validreferrals[r])!=-1){
passed=1
break
}
}
if (passed==0){
alert("Access to the page denied!")
history.go(-1)
}
//-->
</script>
Problem I am having is that if i want the entire domain to be valid
ie. http://myname.sharewith.us
It wont work, could this be anything to do with the webspace i am using? It is a freebie!
The reason i am using this is that i have a password protected section of a website, i dont want anyone typing a page url into the browser and bypassing it.
Any help appreciated, thanks,
PS I am not into scripts at all!
<script>
<!--
/*Referrer Checker- By JavaScript Kit
(www.javascriptkit.com) Over 200+ free JavaScripts here!
*/
//specify valid referrals for script to accept
//if you wish an entire domain to be valid, enter that (ie: "javascriptkit.com")
var validreferrals=new Array()
validreferrals[0]="http://www.javascriptkit.com/script/cut170.shtml"
validreferrals[1]="http://javascriptkit.com/script/cut170.shtml"
var passed=0
for (r=0;r<validreferrals.length;r++){
if (document.referrer.indexOf(validreferrals[r])!=-1){
passed=1
break
}
}
if (passed==0){
alert("Access to the page denied!")
history.go(-1)
}
//-->
</script>
Problem I am having is that if i want the entire domain to be valid
ie. http://myname.sharewith.us
It wont work, could this be anything to do with the webspace i am using? It is a freebie!
The reason i am using this is that i have a password protected section of a website, i dont want anyone typing a page url into the browser and bypassing it.
Any help appreciated, thanks,
PS I am not into scripts at all!