Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User IP

Status
Not open for further replies.

mirfan

Programmer
Feb 4, 2005
13
PK
hello

how can i get the IP address of the users, which are accesing my site...along with the time of access.

bye

 
time:

two methods:
1. you can either use the time() function within php which will give you the time that the relevant line of the script is called.
2. you can use the $_SERVER['REQUEST_TIME'] superglobal. (only available in php 5.1.0 and above.

user IP

use the $_SERVER['REMOTE_ADDR'] superglobal
 
hello
thanks for this....

my server is not 5.1 or above.... so please describe the first method in detail....

thanks again
bye
 
the function time() returns the current unix timestamp.

Code:
echo "current time is ". time();

you can insert the timestamp into a database or parse into a human readable form for display (see the php.net section on date and time functions for how to do the latter).
 
It might be worthwhile pointing out that the IP address is unreliable when used accross the web unless of course your sure that it is valid, for example in a company intranet.
 
hello
I think u people r not getting my point... by using time or date function i'll get the time of the server.. i want to get the time of the client....that, what is the time of the ISP using by a certain user.
bye

 
more difficult i believe.

i'd suggest using some javascript to add the time to a form variable or to the url when the link to the next page was clicked. this will not be the time of the client's ISP but the time of the client's computer.

I do not know a way of obtaining the time of the client's ISP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top