Post your useful php snippets or code here.
This code below, reads from a list of url's in a text file.
It uses cookies.
The person visiting or clicking your link to this file will see the first url in your text file, then next visit, will see the next.. and so on.
Useful for showing different galleries, sending to different sponsors, good with 404 pages, etc.
Code:
<?php
$domain = 'adultdomain.com';
$list = 'urls.txt';
$cookiedays = 7;
/* code below - be careful editing */
$urls = @file($list);
$x = count($urls);
if( !isset($visited) || $visited >= $x ) $visited = 0;
setcookie("visited", ++$visited, time()+($cookiedays*86400), '', ".$domain", 0);
header('Location: ' .$urls[$visited]);
?>