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
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    149
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Store IP in a database

    Hello Guys,

    I just want to know if anyone has a script that allows me to store IP address to mySQl database.

    Thank you

    (i will be blocking people from .htaccess file)
    Tomorrow Could Be Your Day

  • #2
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    356
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Actually its pretty simple.

    Create a table in the database "user_ip"
    depending on how you'd like to record the IPs, there are many ways of collecting and store the data from time/data, user's ip ..etc

    use this to get the user's IP address.
    PHP Code:
    $ipaddress $_SERVER['REMOTE_ADDR']; 
    To add the user's IP into the database, (very simple idea)
    PHP Code:
    $sql_action mysql_query("INSERT INTO user_ip SET ipaddress = '$ipaddress'"); 
    and thats the general Idea, but I still dont know how you'd like it to run, such as record all users, or record users that do something you dont like.

    -Tim


  •  

    Posting Permissions

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