Forum Moderators: coopster
<?php
if (!isset($_GET['number'])) {$a = 1;}
else {$a = $_GET['number'] + 1;}$b = $a+ 1;
$self = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?number='.$a;
header("refresh: 1; url=$self");echo 'You have wasted '.$a.' seconds of your life.';
?>
...at what point should the feeling of concern kick in?
- John
<?php
if (!isset($_GET['number'])) {$a = 1;}
else {$a = $_GET['number'] + 1;}
if ($a > 35) {
echo 'Dont you have something better to do with your life?';
}
else {
echo "You have wasted $a seconds of your life.";
}
$self = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?number=$a";
header("refresh: 1; url=$self");
?>
<?php
if (!isset($_GET['number'])) {$a = 1;}
else {$a = $_GET['number'] + 1;}
$self = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?number=$a";
if ($a > 35) {
die ('Dont you have something better to do with your life?');
}
else {
header("refresh: 1; url=$self");
echo "You have wasted $a seconds of your life.";
}
?>
<edit>
If we are going to do this properly then I have changed the code a little.
As there is no point in continuing the loop past 35.
[edited by: PHP_Chimp at 5:41 pm (utc) on April 2, 2008]
- John