Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    246
    Thanks
    13
    Thanked 26 Times in 24 Posts

    Blocking/Restricting hyperlinks from certain domains?

    Ok, I basically need block ALL visitors coming from certain locations, as the website I work for's population is mainly kids and young teens. So yeah, you see my problem. I would really like to keep them all as safe as possible. One of the main things I'd like to do is block access to it from the 4chan websites, as well as a couple of others. If you know of 4chan, you know why, if not, then assume 4chan is no good. So anyway..

    All I really know on this subject is $_SERVER['HTTP_REFERER'], which returns the referral URL, if there is one. BUT, is there a way to block from all locations on a single website? And if so, how?

    Thanks in advance!
    Last edited by Majoracle; 12-21-2006 at 10:42 PM.

  • #2
    Regular Coder Tyree's Avatar
    Join Date
    Sep 2003
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What you're looking to do could get pretty complicated and if made too stringent, you may end up throwing the baby out with the bathwater.

    First thing to think about is there's no way to block someone who has visited another website.

    One way of coming close is to get the referer and log the IP address of the user who came from that site. And then, in the future always block that IP address from viewing your site. But, that's where you can end up blocking legit users too since IPs can change owners frequently. Generally, IP blocking is a bad idea.

    Otherwise I, personally, don't know of any slick way of doing this.
    Matt Tyree
    TyreeOnline
    If I didn't just "make it worse," show me some love! Hit me with the rep points! :) (The white scales icon on the left)

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    A lot of people have the referrer field turned off in their browser or firewall in order to protect their privacy. There is no way to tell where a visitor came from if they don't want to tell you.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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