what to do?

Discussion in 'PHP' started by archgames.net, Jan 28, 2008.

  1. #1
    I got a code that trackers visitor info (ip,date visited etc)
    what it is meant to do is paste the info in my .txt file
    it does that but only places ip of the visitors...


    heres the php code of the main file (not txt)
    <?php
    $dtime = date('F jS Y, h:iA');
    $ip = $_SERVER['REMOTE_ADDR'];
    $host = gethostbyaddr($ip);
    $agent = $_SERVER['HTTP_USER_AGENT'];
    $uri = $_SERVER['REQUEST_URI'];
    $ref = $_SERVER['HTTP_REFERER'];
    
    if($dtime == ""){
    $dtime = "None Recorded";
    }
    if($ip == ""){
    $ip = "None Recorded";
    }
    if($host == ""){
    $host = "None Recorded";
    }
    if($agent == ""){
    $agent = "None Recorded";
    }
    if($uri == ""){
    $uri = "None Recorded";
    }
    if($ref == ""){
    $ref = "None Recorded";
    }
    
    $entry_line = "
    Date: $dtime
    IP: $ip
    Host: $host
    Browser: $agent
    URL: $uri
    Referrer: $ref
    ---------------
    ";
    $fp = fopen("visits.txt", "a");
    fputs($fp, $entry_line);
    fclose($fp);
    ?>
    PHP:
    thanks
     
    archgames.net, Jan 28, 2008 IP
  2. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you be more specific? Does just the IP: $ip show up, or do the other prompts show up also in the text file but with no values to them?
     
    Possibility, Jan 28, 2008 IP
  3. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #3
    it only shows ip address of the users doesnt show anything else
     
    archgames.net, Jan 29, 2008 IP
  4. ryepdx

    ryepdx Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ryepdx, Jan 29, 2008 IP
  5. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #5
    nice but whats the problem with mine? =S
     
    archgames.net, Jan 29, 2008 IP
  6. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #6
    working now dont no how lol
     
    archgames.net, Jan 29, 2008 IP