You are here: PHP, MySQL and IP-addresses « PHP Programming Language « IT news, forums, messages
PHP, MySQL and IP-addresses

Posted by J�rn Dahl-Stamnes on 03/11/06 10:03

I use this code to store the IP addresse:

<?php
$IP = $_SERVER['REMOTE_ADDR'];
$query = "update mytable set ipaddr=inet_aton('$IP') where <some code>";
mysql_query ($query);
?>

When I do a 'select inet_ntoa(ipaddr) from mytable' most of the ip-addesses
shows up correctly, but one showed up as "127.255.255.255", which is
meaningless. Comparing to the log, the IP-address was 195.x.x.x

Is the $_SERVER['REMOTE_ADDR'] safe to use? Can it be something else that
the actual source of the http request to my server?

--
Jørn Dahl-Stamnes
http://www.dahl-stamnes.net/dahls/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация