Jump to content
xisto Community
Sign in to follow this  
fadillzzz

[php] Log Visitor's Ip To A Filesometimes, Some Webmasters Wants To Know How Many Differents Visitor Visit His/her Site So They Use A Script To Log Th

Recommended Posts

Sometimes, some webmasters wants to know how many differents visitor visit his/her site
so they use a script to log the visitor's IP to a file

and here is the code

$ip = getenv("REMOTE_ADDR"); 		 (file_put_contents(myvisitors, "\n - VISITOR_IP -> $ip", FILE_APPEND ));

the code above will create a file named "myvisitors"
you can view the file using any text editor

if you also want to show the visitor their IP,
you can use this code
$ip = getenv("REMOTE_ADDR"); 		 echo "->" . $ip;		 (touch (myvisitors));		 (file_put_contents(myvisitors, "\n - VISITOR_IP -> $ip", FILE_APPEND ));

just add the codes above to any of your .php file

Share this post


Link to post
Share on other sites

This is useful script. This script is useful for webmasters who are making websites from scratch and need an easy way to log visitor's IP and also display it on their website.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.