View Full Version : Store IP in a database
03-18-2010, 04:15 PM
I just want to know if anyone has a script that allows me to store IP address to mySQl database.
(i will be blocking people from .htaccess file)
03-18-2010, 09:29 PM
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.
$ipaddress = $_SERVER['REMOTE_ADDR'];
To add the user's IP into the database, (very simple idea)
$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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.