Answer the question
In order to leave comments, you need to log in
Redirect if cookie is "older" than 2 minutes?
Hello. There is a script:
if(empty($_COOKIE['entry_time']))
SetCookie('entry_time', time(), time() + 24 * 60 * 60);
// Через 24 часа
if($_COOKIE['entry_time'] + 24 * 60 * 60 < time())
{
header('Location: http://site.ru/');
}
Answer the question
In order to leave comments, you need to log in
if(empty($_COOKIE['entry_time']))
SetCookie('entry_time', time(), time() + 2 * 60);
// Через 2 минуты
if(!empty($_COOKIE['entry_time']) and $_COOKIE['entry_time'] + 2 * 60 < time())
{
header('Location: http://site.ru/');
}
if (empty($_COOKIE['entry_time'])) {
SetCookie('entry_time', time(), time() + 24 * 60 * 60);
} else {
if ((time() - $_COOKIE['entry_time']) >= 2 * 60) {
header('Location: http://site.ru/');
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question