modified:video cookie lifetime if video duration is bigger than one hour

This commit is contained in:
ASponch 2018-01-29 10:42:26 +01:00
parent 6a92a03a4d
commit 54eed43f55

View file

@ -2181,8 +2181,11 @@
{
if(!isset($_COOKIE['video_'.$id])) {
$currentTime = time();
$vdetails = get_video_details($id);
// Cookie life time at least 1 hour else if video duration is bigger set at video time.
$cookieTime = ($vdetails['duration'] > 3600) ? $vdetails['duration'] : $cookieTime = 3600;
$db->update(tbl("video"),array("views", "last_viewed"),array("|f|views+1",$currentTime)," videoid='$id' OR videokey='$id'");
setcookie('video_'.$id,'watched',time()+3600);
setcookie('video_'.$id,'watched',time()+$cookieTime);
}
}
break;