Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #11 (permalink)  
Old December 5th, 2004, 09:25 PM
Authorized User
 
Join Date: Dec 2004
Location: welland, ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #12 (permalink)  
Old December 5th, 2004, 09:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

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.

  #13 (permalink)  
Old December 5th, 2004, 10:12 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

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
  #14 (permalink)  
Old December 5th, 2004, 10:18 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Click the this link for demo
http://home.cogeco.ca/~grimreaper/ConfidentialPage.html


Cheers :)

vinod
  #15 (permalink)  
Old December 5th, 2004, 10:27 PM
Authorized User
 
Join Date: Dec 2004
Location: welland, ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #16 (permalink)  
Old December 5th, 2004, 10:52 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

 http://n.1asphost.com/vinodvinod/loginpage1.html

Cheers :)

vinod
  #17 (permalink)  
Old December 5th, 2004, 10:53 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

This is working in my case
http://n.1asphost.com/vinodvinod/ConfidentialPage.html

Cheers :)

vinod
  #18 (permalink)  
Old December 5th, 2004, 10:58 PM
Authorized User
 
Join Date: Dec 2004
Location: welland, ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://home.cogeco.ca/~grimreaper/home



your test worked...:)

Holmes
  #19 (permalink)  
Old December 5th, 2004, 11:02 PM
Authorized User
 
Join Date: Dec 2004
Location: welland, ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

double post?


http://home.cogeco.ca/~grimreaper/home/

Holmes
  #20 (permalink)  
Old December 5th, 2004, 11:08 PM
Authorized User
 
Join Date: Dec 2004
Location: welland, ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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




Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Redirect based on given URL somnath.kartic VS.NET 2002/2003 1 August 2nd, 2012 08:21 AM
URL rewriting with URL forwarding mtabyana BOOK: Professional Search Engine Optimization with PHP: A Dev's Guide to SEO ISBN: 978-0-470-10092-9 0 October 22nd, 2007 08:22 AM
displaying the email referral ami PHP How-To 0 June 14th, 2006 04:16 AM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.