Jump to content

storing ip adresses


runnerjp

Recommended Posts

As long as its nothing that has to be 100% reliable, there is no harm in doing it. But if you are doing it to ban a person from a site, its not going to work. If you are doing it to record who posted something on a site or uploaded a file or whatnot, its a good idea - it gives you some form of traceability in the future if you need it.

Link to comment
https://forums.phpfreaks.com/topic/101843-storing-ip-adresses/#findComment-521189
Share on other sites

Personally, anytime a new row is created in a table, I add the person's IP address. I get it right then and there, as IP addresses are dynamic. I use the following function to get them:

 

function get_ip_address()
{
	if($_SERVER['HTTP_X_FORWARDED_FOR'] != "")
	{
		return $_SERVER['HTTP_X_FORWARDED_FOR'];
	}
	$ip = $_SERVER['REMOTE_ADDR'];
	return $ip;
}

Link to comment
https://forums.phpfreaks.com/topic/101843-storing-ip-adresses/#findComment-521200
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.