Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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.

Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.