Code:
$A_offers = array();
$A_offers[1] = array("1","OFFER1");
$A_offers[2] = array("2","OFFER2");
$A_offers[3] = array("3","OFFER3);
$A_offers[4] = array("4","OFFER4");
$myFile = "count.txt";
$fh = @fopen($myFile, 'r');
$offerNumber = @fread($fh, 5);
@fclose($fh);
if ($offerNumber >= count($A_offer)) {
$offerNumber = 1;
} else {
$offerNumber = $offerNumber + 1;
}
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $offerNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);
$b = $A_offers[$offerNumber][0];
$reward = $A_offers[$offerNumber][1];
I have a count.txt file in my directory. Im not sure whats wrong with this coding, could i get some hlep?
my $b is my rotation ID
and my $reward is my dynamic text that is displayed depending on the b value.
if anyone could help me out here that would awesome.... My offers don't seem to be rotating