I'm doing a small forum on the web by PHP. I was wondering how to do the registration. Namely, I decided to ask user email and then sen开发者_Python百科 her/him mail that contains a link that should be pressed at most two days after the server sent a mail. But it is possible for server to see what time the link was clicked? Or is there any better methods to do the registration?
You can see which time the link was clicked using the date or time functions in PHP.
Once the link is clicked you can use php function date or time to log the current date.
If you also log the registration date, you can easily create a function which checks if the confirmdate is expired or if it's not.
This is an example how date comparison is done:
<?php
$date1 = "2007-10-25";
$date2 = time();
$dateArr = explode("-",$date1);
$date1Int = mktime(0,0,0,$dateArr[1],$dateArr[2],$dateArr[0]) ;
echo "$date1Int compare to $date2 difference is ".($date1Int-$date2);
?>
精彩评论