Results 1 to 13 of 13
  1. #1

    help with PHP IP Logging

    well here's the link I found for a PHP IP Log Script but when I inputted it into my PHP index.php file on the appropriate spot...

    It won't log down the IP...

    http://www.developerz.com/php_iplogger.htm

  2. #2
    Join Date
    Nov 2000
    Posts
    3,042
    PHP Code:
    <?php
    # The full path to log file: #
    $log_file "ip.txt";
    $ip $_SERVER['REMOTE_ADDR'];
    $fp fopen ($log_file"a");

    if (
    flock($fpLOCK_EX)) 
    {
       
    fwrite($fp$ip "\n");
       
    flock($fpLOCK_UN);
    } else {
       echo 
    "Couldn't lock the file !";
    }

    fclose ($fp);
    echo 
    "Your IP Address has been logged: " $ip;
    ?>
    A well-reasoned assumption is very close to fact.
    - Adorno

  3. #3
    still doesn't work well....

    Go to the bottom of my blog and tell me what's wrong....

    http://t3chb0yg3n13.gameblock.net/blog

  4. #4
    Join Date
    Nov 2000
    Posts
    3,042
    Your host is the problem... it's saying that writable connections aren't allowed, so there is no way to make it work.
    A well-reasoned assumption is very close to fact.
    - Adorno

  5. #5
    o no wonder.......some of my installed PHP scripts didn't work due to the same problem

  6. #6
    Join Date
    Apr 2005
    Posts
    42
    You can't modify/create/delete files if you give a "http://" path because the file is actually being requested over the internet rather than from the same machine, so it will get executed by whichever pre-processor it requires.

    That is why you are getting the error:

    HTTP wrapper does not support writeable connections

    You need to use a relative path, or an absolute path that does not use http://....

    instead of
    fopen("http:///t3chb0yg3n13.gameblock.net/blog/ip.txt")

    which should have been:

    fopen("http://t3chb0yg3n13.gameblock.net/blog/ip.txt");

    try

    fopen("./ip.txt");

    or

    fopen("ip.txt");

  7. #7
    Join Date
    Nov 2000
    Posts
    3,042
    That's exactly what he's using.
    A well-reasoned assumption is very close to fact.
    - Adorno

  8. #8
    Join Date
    Nov 2000
    Posts
    3,042
    Hmmm interesting... it appears that it is being wrapped in the HTTP protocol, which doesn't make much sense, since my code doesn't ask for that.

    Try changing this:
    fopen("ip.txt");

    to:
    fopen("/home/block/public_html/t3chb0yg3n13/blog/ip.txt");

    I'm guessing your host, or blog software is automatically appending a URL to it, so using a full path should void that.
    A well-reasoned assumption is very close to fact.
    - Adorno

  9. #9
    Join Date
    Oct 2003
    Location
    Georgetown, Ontario
    Posts
    1,761
    Make sure that the file has write permissions as well.
    ии Repeat after me... ProSupport is the best... Prosupport is... ии
    ProSupport Host Support System - OUT NOW! Grab a copy yourself and see what the hype is about!
    VertiHost Inc. - We run a quality business. Do you?

  10. #10
    Join Date
    Apr 2005
    Posts
    35
    For debugging purposes chmod everything to 777, once it works set it to a more suitable setting and something more secure for this purpose.

  11. #11
    thx guys...it works!!!

  12. #12
    Join Date
    Jun 2004
    Location
    Bay Area -USA
    Posts
    1,738
    oh no you got my ip. lol
    <<< Please see Forum Guidelines for signature setup. >>>

  13. #13
    rofl....one again thx guys ....This forum is the best!!!!!!

Posting Permissions

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