31-01-2005, 21:05
|
|
|
חבר מתאריך: 07.12.04
הודעות: 2,153
|
|
הנה משהו קצת יותר מדוייק ואמין...
קוד PHP:
<?php
$dfile = "data.txt"; //data file
$handle = fopen( "$dfile" , "a+" ); //resource handle
if (!$_COOKIE['online']) { fwrite( $handle , time()."-" ); //write the time according to the unix timestamp setcookie( "online" , "bla" , time()+60 ); }
$data = file_get_contents( "$dfile" ); //get data from the data file
$get_array = explode( "-" , $data ); //seperates each entrance
$conter = 0; for ($i=0 ; $i<count( $get_array ) ; $i++) { //getting the data relevent to the time now! if ( $get_array[$i] + 60 > time()) $counter = $counter+1;
}
echo $counter;
?>
שים לב שהקאונטר הזה יעדכן עצמו אחת לדקה!
|