rickyboy1982 Posted September 16, 2010 Share Posted September 16, 2010 HiI have not got a script yet but am looking into the best ways to get a usrs Ip address and store it in a database...This is mainly for a member registration script, so i can ban users Ip addresses if needs be. Link to comment Share on other sites More sharing options...
Synook Posted September 16, 2010 Share Posted September 16, 2010 The IP address can be found as the value of $_SERVER['REMOTE_ADDR']. You can then use a standard SQL query to store it in your database. Link to comment Share on other sites More sharing options...
End User Posted September 16, 2010 Share Posted September 16, 2010 You can use this to try and get the real IP address: if (getenv('HTTP_CLIENT_IP')) { $ip_address = getenv('HTTP_CLIENT_IP');}elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip_address = getenv('HTTP_X_FORWARDED_FOR');}elseif (getenv('HTTP_X_FORWARDED')) { $ip_address = getenv('HTTP_X_FORWARDED');}elseif (getenv('HTTP_FORWARDED_FOR')) { $ip_address = getenv('HTTP_FORWARDED_FOR');}elseif (getenv('HTTP_FORWARDED')) { $ip_address = getenv('HTTP_FORWARDED');}else { $ip_address = $_SERVER['REMOTE_ADDR'];} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.