Web Hosting Talk







View Full Version : Countdown Depending on number?


Hatcher
07-31-2003, 09:51 AM
Ive tried the many times but i keep failing :( Its for a preview of a site. Depending on the user level which is a number, the countdown logsthem out after a certain time.

I want it so that the higher the level the longer they get. EG: f the level is 1, it takes 1 hour, each level it goes up, they get an extra 25% of the time, and their user level goes up, so the mroe they visit, the longer time they get.

All i need is a script that countsdown, and increases by 25% of the time they had last time. I will be very greatful

- Hatcher

eicklerr
08-19-2003, 07:19 PM
Not really sure if this is what you need, but it might point you in the right direction:




<?php

$level = 10;
$timeout = 60;

for ( $i=1; $i<=$level; $i++) {
echo "Timeout for level: " . $i . " = " . $timeout . "\n";
$timeout = sprintf( "%.0f", ( $timeout + ( $timeout * .25 ) ) );
}

?>




Output looks like this:

Timeout for level: 1 = 60
Timeout for level: 2 = 75
Timeout for level: 3 = 94
Timeout for level: 4 = 118
Timeout for level: 5 = 148
Timeout for level: 6 = 185
Timeout for level: 7 = 231
Timeout for level: 8 = 289
Timeout for level: 9 = 361
Timeout for level: 10 = 451


:D