Every php developer want to store IP address of visitor for tracking and other different purpose. Here is the function which i'm using in my script to store ip address in database.
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ function visitorIPAdd() { /* This returns the IP of the visitor calling the requested page Checks to see if HTTP_X_FORWARDED_FOR has a value then the client is operating via a proxy */ $visitorIP = $_SERVER['HTTP_X_FORWARDED_FOR']; if($visitorIP == "") { $visitorIP = $_SERVER['REMOTE_ADDR']; } return $visitorIP; // return the IP address } ?>
0 comments:
Post a Comment