PHP: Getting details like ip address and time
I want to get details of user when he registers with my website for security reasons. I need ip and date and time I guess. Is there anything else I need to cache while registering? How to get ip,time and date? And time will be in which timezone? I want it in GMT +5:30 means asia - culcutta. Thanks in advance.
And i want to save user log in time. Any help about this will be thankful.
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
$IP = $_SERVER['REMOTE_ADDR'];
$date_time = date("l j F Y g:ia", time() - date("Z")) ;
echo "$date_time IP: $IP";
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
Thank you all. It done my work. But I have a last question. What would be better format to store user's login time? Like 1296143233 or Thursday 27 January 2011 3:47pm? Thank you. And how to convert 1296143233 to Thursday 27 January 2011 3:47pm. I think first format will save the disk space. Please help.
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Hey thanks.... My work will get done by this.. Thank you so much to all of you who helped......
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0