 |
| Javascript How-To Ask your "How do I do this with Javascript?" questions here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 5th, 2004, 09:25 PM
|
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi vinod_yadav1919,
i'm doing everything your saying,
but its stiull not working.
I tried one (=) out of " if(domainname==referal_list[i])"
and the login was succesful, but it was successful from anywhere.
If you have the time, can you make a test.html and see what i'm doing wrong?
Thanks again...lol
Holmes
|
|

December 5th, 2004, 09:26 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The reason it returns false even when reffered by "http://home.cogeco.ca/~grimreaper/" is this line:
Code:
domainname=domainname.substring(0,domainname.indexOf("/"))
it matches the _domainname_ not the url... It looks for the first forward slash.
I haven't tested the script, but I assume it will work if you put "home.cogeco.ca" in the list of accepted refferers. Note: the previous line strips off the "http://"-part.
|
|

December 5th, 2004, 10:12 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
http://p2p.wrox.com/topic.asp?TOPIC_ID=22966
Now Click on the link Below
<a href="http://home.cogeco.ca/~grimreaper/ConfidentialPage.html">FromAnotherServer</a>
Cheers :)
vinod
|
|

December 5th, 2004, 10:18 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
|
|

December 5th, 2004, 10:27 PM
|
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I dont undestand what you just said.
Heres my code again:
<script>
function IsValidReferral()
{
from=document.referrer
domainname=from.substring(from.indexOf("//")+2,from.length)
domainname=domainname.substring(0,domainname.index Of("/"))
var referal_list=new Array("home.cogeco.ca","GRIMS_LOGIN/","http://home.cogeco.ca/~grimreaper/");
flag=false;
for(i=0;i<referal_list.length;i++)
{
if(domainname==referal_list[i])
{flag=true
break;
}
}
if(!flag)
{alert("You are Invalid User"+from)
//It's not a referral site,Move to your login Page
location.href="http://home.cogeco.ca/~grimreaper/"
}
else
{alert("success")
}
}
IsValidReferral();
</script>
Note: Array, i tried all individually, named the login page Grims_login
This is how it should all look, right?
Holmes
|
|

December 5th, 2004, 10:52 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
|
|

December 5th, 2004, 10:53 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
|
|
|
|

December 5th, 2004, 10:58 PM
|
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

December 5th, 2004, 11:02 PM
|
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

December 5th, 2004, 11:08 PM
|
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
for some strange reason i cant see my postings after the
Posted - 12/05/2004 : 9:27:39 PM
Thank you vinod, your test worked,
I'm just trying it out with my site now,, but cant check a link from this server.
So the only reason its not working from here is because i trying from the same server?
Thanks again..
Holmes
|
|
 |