Results 1 to 6 of 6

Thread: Recording IP's

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    85

    Recording IP's

    I'm having a bit of a problem. I've been looking for a tutorial that will record my visitors IP addresses when they open up my page. But all the ones I find and try don't work. I'm using mySQL. Could anyone help me out?

    Syrillia

  2. #2
    Lively Member
    Join Date
    Feb 2008
    Posts
    101

    Re: Recording IP's

    Grr posted the wrong code hold on

    And you would need to code in
    Code:
    $ip = $_SERVER["REMOTE_ADDR"];
    try looking at http://www.w3schools.com/PHP/php_mysql_create.asp for more help I learned some stuff that helped me

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    85

    Re: Recording IP's

    I have this;

    $ip = getenv('REMOTE_ADDR');
    $query = "INSERT INTO iptable (ipaddress) VALUES ('$ip')";
    mysql_query ($query)
    or die ("Query failed: " . mysql_error() . " Actual query: " . $query);

    How would I make it only record the IP adress once?
    Last edited by syrillia; Jul 9th, 2008 at 05:03 PM.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Recording IP's

    Its a little pointless recording only an IP address. If you wanted anything meaningful you should record the IP address and the time at the very least. If this is the case it might be better having a table of IP addresses and linking this to a table of additional information such as date/time, URI and action.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    85

    Re: Recording IP's

    I only wanted the IP recorded. Just so I can track visiting IP's.

  6. #6
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Recording IP's

    well if you are tracking IP's you are still going to want to know the time, so you know when they were visiting.

    there is a link in my sig about MySQL Help, that should...help.
    My usual boring signature: Something

Posting Permissions

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



Click Here to Expand Forum to Full Width