How to get IPaddress and time?

Hi all,
I want to display to the users, from which IPaddress and what time the user login and last visit time…

I know how to get IPaddress, but how to get the time at the user been login?

and also, when a guest clicks on the link, i want to increment the count to + 1.
If the same guest(means from same IP address) clicks more than once, i want to check the time interval between two clicks say 10 min, and then i want to increment…

For that purpose, i want to know the IP address as well as current time.

Can any one help me regarding this?

Thanking you…

To get the time you can use php’s time functions

http://php.net/manual/en/function.time.php

I suggest that you store the time in a cookie http://php.net/manual/en/function.setcookie.php . When a user comes to your site, check if a cookie exists, if it does, compare the time stored in the cookie to the current time.

See:


print_r($_SERVER);

This will give you the IP address and even the LAN IP too.

And for handling the date time see the date() function.

Edit:
And to store the date/time, as suggested earlier, use setcookie function.