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 2 of 2

Thread: IP tracking

  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IP tracking

    Hi,

    Maybe not a good place to ask but can anyone help me with a simple but good working script that's display's the ip adres of a visitor to a site, the scripts i found don't seem to work, most my visitor's use IE 5.0 and above.

    Thanks

  • #2
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi


    what you are asking is very easy to do!

    ip.pl.......

    PHP Code:

    #!/usr/local/bin/perl -w


    print "Content-type: text/html\n\n";


    $ip "$ENV{'REMOTE_ADDR'}";


    print 
    "Your IP: $ip";


    # log it maybe.....

    $found 0;
    open (DATA"log.txt");
    while(<
    DATA>) {
    $line $_;
    chop $line;
    if (
    $line =~ m/^($ip)$/) {
    $found 1;
    last;
    }
    }

    if (!
    $found) {
    open (DATA">>log.txt");
    flock(DATA2);
    print 
    DATA "$ip\n";
    close (DATA);
    }
    exit(
    0);

    # end script 


    F!


  •  

    Posting Permissions

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