Advertisement
crayawn

Cookie Redirect

Jun 25th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. *
  5. * Periodical Cookie Redirect
  6. * (c)2013 Dennis Kupec
  7. *
  8. */
  9.  
  10. $_redirect_time = "3600"; // Time in seconds for each redirect (3600 = 1 hour)
  11. $_redirect_link = "http://google.com"; // Link to redirect to (eg. http://google.com)
  12.  
  13. /*
  14. * Ignore everything below here
  15. */
  16.  
  17. $_newtime = time()+$_redirect_time;
  18.  
  19. if(!isset($_COOKIE["redirtime"])) setcookie("redirtime", $_newtime);
  20.  
  21. if($_COOKIE["redirtime"]<=time()) {
  22.     setcookie("redirtime", $_newtime);
  23.     header("Location: ".$_redirect_link);
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement