View Single Post
Old 10-14-2021, 07:22 AM  
vdbucks
Monger Cash
 
Industry Role:
Join Date: Jul 2010
Posts: 2,773
My bad for not getting back to you sooner...

I looked through all of our old tours but couldn't find the exact code we used. It's something along the lines of this though:

Code:
<?php

// use your variable here
$ID_OF_VIDEO_HERE = $_REQUEST['video'];

if(isset($_SESSION) === false)
  session_start(); // Start PHP session management
if(isset($_SESSION['videos_viewed']) === false)
  $_SESSION['videos_viewed'] = array();

if(isset($_SESSION['videos_viewed'][$ID_OF_VIDEO_HERE]) === FALSE AND count($_SESSION['videos_viewed']) >= 3)
{
  // Redirect the User
  header('location: http://SUBSCRIBE_PAGE');
  exit();
}
else
{
  // Add current video ID to list
  $_SESSION['videos_viewed'][$ID_OF_VIDEO_HERE] = true;
}

// JUST FOR TESTING
var_dump($_SESSION['videos_viewed']);

?>
vdbucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote