35 users online (1 members and 34 guests)  


  Results 1 to 4 of 4

Related

  1. Replies: 1
  2. How does the client user access my intranet website    Forum: One Stop Domains Forum
    Replies: 0
  3. Replies: 1
  4. Help with my perl script    Forum: CGI Perl Forum
    Replies: 1
  5. Please Help me (Perl Script)    Forum: CGI Perl Forum
    Replies: 1
  1. #1
    poiuytrtyuiop's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2006
    Posts
    1

    perl script to limit access to website

    Hi,

    I need to write a script to prevent people from visiting my site too often. For example, if a person from a given IP address tries to visit my site for the 6th time in one day, he/she will be denied.

    There are probably many ways to do something like this, and I was just wondering if anyone could point me in the right direction.

    - Should I be learning about writing an Apache module?
    -Could I just run a program on my server which runs constantly, and which a cgi script could "talk to" when a user visits my site, to find out if this user has already visited too many times?

    Thank you very very much for your help!!

    -Alan

  2. #2
    pageBuzz.com's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2006
    Posts
    21

    Re: perl script to limit access to website

    Alan - I am not sure how you would limit users or why.

    One way you could do that is to block an ip using a .htaccess file in the main directory.

    Use a perl script to deliver a 1 pixel image to a page, each page I guess. You can call the script using an img src tag.

    have a file with the ips that have accessed the site, when a user gets to a number, add the ip to the .htaccess file.

    That would be the most simple way to do it. A better way is to deliver the pages via cgi and just create a bunch of complcated subs to mange traffic.

    You can download my captcha script at
    http://bumblebeeware.com/captcha/

    That script uses an image tag to write an ip to a datafile. It might give you some ideas about implimenting the scripts and printing an image to a page.

  3. #3
    ivan8r's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    1

    Re: perl script to limit access to website

    Did you ever find a solution? I'm trying to do the exact same thing you mentioned in your post.

  4. #4
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: perl script to limit access to website

    You could get the IP address everytime someone enters the site...
    Store a file named by the IP address...
    In there, store a number which starts at 1 the first time someone comes in...
    Everytime someone comes to the website, search for files named by the IP address, if it finds it OPEN IT, check what the number is
    If the number is below 6 then let them access the site, and + 1 to the number
    if it is above 6 then dont let them access the site...
    Simple.
    Let me know if you can't write the Perl



Tags for this Thread