Forum Moderators: coopster
<?php
//----------------START RUN AT TOP OF PAGE, BEFORE ANY HTML -------//
//how many offers do you want to chain together.
$numberOfOffers = 2;
//leave blank if the offers are in the same directory as this script.
//Do NOT include trailing slash.
$offersDirectory = '';
//Do NOT change this variable.
//Add offer names to this array, as they become available.
$offerNames = array('incomeweb','cocc','czcc');
$nextbutton = NULL;
$_COOKIE['completed'][] = 'cocc';
if(isset($_POST['offer'])) {
$count = count($_POST['offer']);
if($count > 1) {
$nextbutton = '<form action="" method="post">'."\n";
for($i = 1; $i < $count; $i++) {
if(isset($_POST['offer'][$i])) {
$nextbutton .= '<input type="hidden" name="offer[]" value="'.$_POST['offer'][$i].'" />'."\n";
}
}
$nextbutton .= '<input type="submit" name="next" value="Next"/>
</form>."\n"';
}
if(in_array($_POST['offer'][0],$offerNames)) {
$page = $offerDirectory . '/' . $_POST['offer'][0] . '.php';
}
}
else {
if(isset($_COOKIE["completed"])) {
$openNames = array_diff($offerNames,$_COOKIE['completed']);
if(!empty($openNames)) {
$openOffers = @array_rand($openNames,$numberOfOffers);
$count = count($openOffers);
if($count > 1) {
$nextbutton = '<form action="" method="post">'."\n";
for($i = 1; $i < $count; $i++) {
if(isset($openOffers[$i])) {
$nextbutton .= '<input type="hidden" name="offer[]" value="'.$openOffers[$i].'" />'."\n";
}
}
$nextbutton .= '<input type="submit" name="next" value="Next"/>
</form>'."\n";
}
$page = $offersDirectory . '/' . $offerNames[$openOffers[0]] . '.php';
}
else {
header('Status: 200');
header("Location: http://www.mydomain.com/signup.html");
}
}
else {
$page = $offersDirectory . '/' . $offerNames[0] . '.php';
}
}
//--------------END RUN AT TOP OF PAGE ---------------------------//
//NEXT LINES GO WHERE YOU WANT THE PAGE INCLUDED IN YOUR SCRIPT.
if(isset($page)) include_once($page);
echo $nextbutton;
//LINES ABOVE GO WHERE YOU WANT THE PAGE INCLUDED IN YOUR SCRIPT.
//This will go on every offer page to create a cookie
// incomeweb.php
setcookie("completed[]","incomeweb", time()+60*60*24*365*10);
// cocc.php
setcookie("completed[]","cocc", time()+60*60*24*365*10);
// czcc.php
setcookie("completed[]","czcc", time()+60*60*24*365*10);
?>