Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title></title>
- <script type="text/javascript" src="jquery.min.js"></script>
- <script type="text/javascript">
- function videoEnded() {
- //Function called when the video is ended
- //We add a GET video to call our php function
- window.location.href = window.location.href+"?video=1";
- }
- </script>
- </head>
- <body>
- <?php
- if(isset($_COOKIE["alreadysawvideo"]))
- {
- //If the cookie is already set, then the video has already been saw
- //So we just redirect the user to the page we want.
- header("location: http://yoursite.com");
- } else if (!empty($_GET['video'])){
- //If the video GET thing is not empty it means the user just saw the video we can redirect him to the website
- //We add a cookie to remember for the next time that he already saw the video
- $year = time() + 31536000;
- setcookie('alreadysawvideo', 1, $year);
- header("location: http://yoursite.com");
- }
- ?>
- <video src="yourvideo.mp4" id="video" controls onended="videoEnded()"></video>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement