PHP timeout function to verify whether the user is logged in_PHP tutorial

WBOY
Release: 2016-07-13 17:40:39
Original
903 people have browsed it

Through the action time, if the action time times out, it will be kicked out! Using mktime is a good time calculation function
that can easily calculate the time difference. The smallest unit is seconds.

Function

function user_mktime($onlinetime){
$new_time = mktime();
echo $new_time-$onlinetime;
if($new_time-$onlinetime > 100){
echo "Login timeout";
session_destroy();
}else{
$_SESSION[times]=mktime() ;
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486201.htmlTechArticleThrough the action time, if the action time times out, it will be kicked out! Using mktime is a good time calculation function that can easily calculate the time difference. The smallest unit is seconds. Function ?php function us...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!