A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Blocking certain users from your website ?

  1. #1
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21

    Blocking certain users from your website ?

    I've built a website for a friend and he doesn't want people from the isle of man ie manx.net to see his website - he wants to direct them to another page... anyone know how to do this ??

    Cheers

    J

  2. #2
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    code:

    <script language="Javascript">
    if (document.referrer != "http://www.manx.net") {
    window.location="http://www.whatsoever.com/index.html"
    }
    </script>

    Last edited by mave_the_rave; 06-12-2005 at 09:20 AM.
    If someone tells you it can't be done,
    it's probally because they don't know how.

  3. #3
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    wow, that was quick. i love it when you get instant solutions like this. You're a complete star... thanx very much...

    I'll put it right now using my own address to test it... cheers again

    J

  4. #4
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    I think as you want to divert if request came from manx.net then code should of been:-

    code:
    <script language="Javascript">
    if (document.referrer == "http://www.manx.net") {
    window.location="http://www.whatsoever.com/index.html"
    }
    </script>

    If someone tells you it can't be done,
    it's probally because they don't know how.

  5. #5
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    will it work with an ip address too ?

    and if I don't want to other users my source page, can i hide this information ?

  6. #6
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    I'm not too sure. about IP addresses: You will need to experiment.

    The reason I was interested in redirecting was to have 2 domains pointing at the same
    address. Then according to which domain it come from it would direct the user to the correct area. Therfore you can have 2 separate web sites with one service provider. You would of coarse need to disable the back button or you would go back to the other site.
    If someone tells you it can't be done,
    it's probally because they don't know how.

  7. #7
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    interesting... hadn't thought about the back button, do you know how to do that ? Is that one of those scripts that kidnaps you sometimes on a certian page and you can only get away from by selecting the drop-down menu on the back button ? ie when you hit the back button you don't go anywhere...

    will experiment... have to go and do some work on my other house now...

    thanks for you time and knowledge!! - i'll check back later for further messages... cheers
    Last edited by kreatiff; 06-12-2005 at 10:18 AM.

  8. #8
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    actually you were right first time, it needs to be... != not ==.

    my friend will be very happy with this!!

  9. #9
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    ps.. and the back button is ok too...

  10. #10
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    Whoops... update! Actually when I changed the information of the refer to manx.net from my own of pol.co.uk, even after clearing the history etc etc.. I was still referred to bbc.co.uk (site I chose for referral).... any ideas why ithe script didn't discriminate between me and other users ?

  11. #11
    Junior Member
    Join Date
    Apr 2005
    Location
    York
    Posts
    21
    Ok - now I'm getting a little confused...

    I applied the script, the second one, and found that it worked, that is until I changed to my provider. It didn't discriminate between my address and that of manx.net. So I went back to the script and played around with a few things and found that putting back the double == sign allowed me to view the page under testing without being referred... now this doesn't necessarily mean that its begun to discriminate, but its didn't come up with an error cade the way it did when i had one = sign on each line...

    <script language="Javascript">
    if (document.referrer == 'http://www.manx.net') {
    window.location = 'http://www.whatsoever.com/index.html'
    }
    </script>

    I was also forgetting to put in the http on the manx address, which didn't help...

    Anyway would appreciate some more of your knowledge at this point...

    Cheers

    J

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center