13 Ιουνίου 2007

It may be a good time to go to bed(.php)

$max_coffees_per_day=4;
$arglist = array();
$arglist = array_merge($_POST,$_GET);
$what_to_drink_next = 'coffee';

if (array_key_exists('coffee_units', $arglist)){
if ($max_coffees_per_day == $arglist['coffee_units']) {
$what_to_drink_next = 'red bush tee';
}
}
if (drink_a_coffee($what_to_drink_next) != 'up and running' ) {
print "It may be a good time to go to bed\n";
die;

}

function drink_a_coffee ($anyDrink) {
$user_status = '';
make_a_drink($anyDrink) or die ("Could not prepair a cup of $anyDrink, a leathal error occurred");
sip_a_drink ('200ml', $anyDrink) or die ("Chocked to death on $anyDrink, a leathal error occurred");
if ($anyDrink == 'coffee') {
$arglist['coffee_units'] = $arglist['coffee_units'] +1;
}
$user_status = 'up and running';
return ($user_status);

}

function make_a_drink ($anyDrink) {
...
}
function sip_a_drink ($anyChunkOf, $anyDrink) {
...
}