Logging IP addresses - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Logging IP addresses

Helooooooo everybody. I am having some problems with a few people. They go on my website and fill up my guest book with complete S***. I want to log the IP addresses of all the people who visit my site from now on so that I could report it.
Assume that there is a text file called "log.txt" in my web directory, how could I write append the ip addresses to the file.

Otherwise just tell me how can I atleast show and scare the visitor their IP address. I would prefer HTML please.

Thanks a looooooooooooooooooooot.

Comments

  • Unfortunatelly, there's no html for getting ips. You would have to use perl/cgi. The code would be:

    #!/usr/bin/perl

    #Open file for writing
    open (WRITEFILE,">>log.dat");
    #Write the new value into counter.dat
    $IP=$ENV{REMOTE_ADDR};
    print WRITEFILE "$IP";
    close (WRITEFILE);

    #close the file

    Hope this works ;)
    fabs -> www.ypronline.com

    : Helooooooo everybody. I am having some problems with a few people. They go on my website and fill up my guest book with complete S***. I want to log the IP addresses of all the people who visit my site from now on so that I could report it.
    : Assume that there is a text file called "log.txt" in my web directory, how could I write append the ip addresses to the file.
    :
    : Otherwise just tell me how can I atleast show and scare the visitor their IP address. I would prefer HTML please.
    :
    : Thanks a looooooooooooooooooooot.
    :


  • Hi fabs and thanks for your help. Is cgi supported by Internet Explorer? I am using Front Page and it does not seem to be working. It just displays the code on the page and does not actually do anything. Please help.
    Thanks

  • : Hi fabs and thanks for your help. Is cgi supported by Internet Explorer? I am using Front Page and it does not seem to be working. It just displays the code on the page and does not actually do anything. Please help.
    : Thanks
    :

    A cgi-script is run on the server, there it read files, stores data, etc..., and then the output (html-code mostly) is send to your computer, and IE. The reason that it doesn't work is that you can't just open it, you need a server program, you can download many (small) programs for free, that act as a local server and can execute cgi-scripts.

    www.apache.org
    www.xitami.com

    and many more on www.tucows.com

    I myself use Xitami, and it works pretty good :-)

Sign In or Register to comment.