All pastes #168067 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-12 17:33 UTC
rendered paste body
<?php
function totalref() {
$days = 7; //AT THIS PIONT, $DAYS IS THE SAME AS $_POST['DAYS'];
global $referrals;
$days2 = 0;
$days--; //HERE I DECREASE DAYS BY ONE TO ALLOW FOR A ZERO COUNT.

$refinquestion = '320';


$ramt = array(
	'BUNDLE_A' => '250',
	'BUNDLE_B' => '500',
	'BUNDLE_C' => '1250',
	'BUNDLE_D' => '2500',
	'BUNDLE_E' => '3750',
	'BUNDLE_F' => '5000'
);

while ($days2 <= $days) {
	$dtemp = date(dny,mktime(0, 0, 0, date("n")  , date("d")-$days2, date("y")));
	$date[] = $dtemp;
	$days2++;
	$currentread = '../logs/' . $dtemp . '.txt';
	if (file_exists($currentread)) {
		$writevar = fopen($currentread,'r');
		$read = file($currentread);
		foreach($read as $wholething) {
			$newarray = explode('#',$wholething);
			if ($newarray[2] != 99) {
				$ubertemp = $newarray[1];
				$referrals[] = "$newarray[2]#$ramt[$ubertemp]";
			}
		}
	}
	else { //HERE'S WHERE IT DOES STUFF ONCE IT FINISHES CYCLING THROUGH THE LOGS.
		print_r($referrals);
		break;
	}
}

//THIS CREATES A MULTIDIMENSIONAL ARRAY WITH FORMAT: [1][REF#][REFAMT]
foreach($referrals as $value) {
	$keyandvalue = explode('#',$value);
	$ref2[] = $keyandvalue;
}

//THIS WILL DISPLAY TOTAL REFAMOUNT
$numPayouts = 0;
foreach($ref2 as $key) {
//print $key[1] . "\n";
		$sum = $sum + $key[1];
$numPayouts++;
}
$totalref = "Total Referral Payouts: $sum.<br>Total Number Of Referral Payouts: $numPayouts.";
return $totalref;
}
?>