Hi guys i m using this code below on my domain to rotate a few affiliate link. i need help from php expert here to add some code so i can cloak the link to show only domain link .
Code:
<?php
function redirect_to($link) {
header("Location: {$link}");
exit;
}
$links = file('links.txt');
while (!$links) {
$links = file('links.txt');
}
$links_count = count($links);
$one_month = 60 * 60 * 24 * 30;
if (!isset($_COOKIE['link_index'])) {
setcookie('link_index', 0, time() + $one_month);
$index = 0;
} else {
$index = $_COOKIE['link_index'] + 1;
setcookie('link_index', $index, time() + $one_month);
if ($index == $links_count) {
setcookie('link_index', 0, time() + $one_month);
$index = 0;
}
}
redirect_to($links[$index]);
?>
WSO 003 - How To Create A Sales Page Generator