'; //echo $second." ".$secondtime; $raznica=$secondtime-$firsttime; //$raznica=round(($secondtime-$firsttime)/60,2); if ($raznica<0) {$raznica=0;} $raznica=round($raznica,1); return $raznica; //echo '
'.($raznica/60); } function raznica_little($first,$second) { $firsttime=0; $secondtime=0; //echo $second; $year=substr($first,0,4); $month=substr($first,5,2); $day=substr($first,8,2); $hour=substr($first,11,2); $min=substr($first,14,2); $sec=substr($first,17,2); $firsttime=mktime($hour,$min,$sec,$month,$day,$year); //echo $firsttime; $year=substr($second,0,4); $month=substr($second,5,2); $day=substr($second,8,2); $hour=substr($second,11,2); $min=substr($second,14,2); $sec=substr($second,17,2); $secondtime=mktime($hour,$min,$sec,$month,$day,$year); //echo $first." ".$firsttime; //echo '
'; //echo $second." ".$secondtime; $raznica=$secondtime-$firsttime; if ($raznica<0) {$raznica=0;} $totalsec=$raznica; //Replace the X's with a int value of seconds $daysarray = explode(".", ($totalsec/86400)); $days = $daysarray[0]; $partdays = fmod($totalsec, 86400); $hoursarray = explode(".", ($partdays/3600)); $hours = $hoursarray[0]; $parthours = fmod($partdays, 3600); $minarray = explode(".", ($parthours/60)); $min = $minarray[0]; $sec = fmod($parthours, 60); $raznica=$hours.'ч '.$min.'мин '.$sec.'сек '; if ($hours==0) {$raznica=$min.'мин '.$sec.'сек ';} if ($min==0 and $hours==0) {$raznica=$sec.'сек ';} return $raznica; return $raznica; //echo '
'.($raznica/60); } function raznica_little_stamp($first,$second) { $raznica=$second-$first; //$raznica=round(($secondtime-$firsttime)/60,2); if ($raznica<0) {$raznica=0;} $totalsec=$raznica; //Replace the X's with a int value of seconds $daysarray = explode(".", ($totalsec/86400)); $days = $daysarray[0]; $partdays = fmod($totalsec, 86400); $hoursarray = explode(".", ($partdays/3600)); $hours = $hoursarray[0]; $parthours = fmod($partdays, 3600); $minarray = explode(".", ($parthours/60)); $min = $minarray[0]; $sec = fmod($parthours, 60); $raznica=$hours.'ч '.$min.'мин '.$sec.'сек '; if ($hours==0) {$raznica=$min.'мин '.$sec.'сек ';} if ($min==0 and $hours==0) {$raznica=$sec.'сек ';} return $raznica; } function bestcheck($a,$c,$id) { $bestcheck=FALSE; $sql = "SELECT id,check".$c.",check".($c-1)." FROM `".$a."` where `check".$c."` <> '0000-00-00 00:00:00' and `check".($c-1)."` <> '0000-00-00 00:00:00';"; $result = mysql_query($sql); $p=1000; $t=1000; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { if (raznica($row[2],$row[1])<$t) {$p=$row[0]; $t=raznica($row[2],$row[1]); }; } if ($p==$id) {$bestcheck=TRUE; } return $bestcheck; } function timeonly($datetime) { $hour=substr($datetime,11,2); $min=substr($datetime,14,2); //$sec=substr($datetime,17,2); $timeonly=$hour.''.$min.''; return $timeonly; } function dateonly($datetime) { $year=substr($datetime,0,4); $month=substr($datetime,5,2); $day=substr($datetime,8,2); $dateonly=$day.'-'.$month.'-'.$year; return $dateonly; } function dateonly_rim($datetime) { $year=substr($datetime,0,4); $month=substr($datetime,5,2); $day=substr($datetime,8,2); if ($month=="01") {$month="I";}; if ($month=="02") {$month="II";}; if ($month=="03") {$month="III";}; if ($month=="04") {$month="IV";}; if ($month=="05") {$month="V";}; if ($month=="06") {$month="VI";}; if ($month=="07") {$month="VII";}; if ($month=="08") {$month="VIII";}; if ($month=="09") {$month="IX";}; if ($month=="10") {$month="X";}; if ($month=="11") {$month="XI";}; if ($month=="12") {$month="XII";}; $dateonly=$day.'.'.$month.'.'.$year; return $dateonly; } function mesto($point,$game) { if ($game=="light") { if ($point=="30") {$mesto="1";} if ($point=='28') {$mesto='2';} if ($point=='26') {$mesto='3';} if ($point=='25') {$mesto='4';} if ($point=='24') {$mesto='5';} if ($point=='22') {$mesto='6';} if ($point=='21') {$mesto='7';} if ($point=='20') {$mesto='8';} if ($point=='19') {$mesto='9';} if ($point=='18') {$mesto='10';} if ($point=='16') {$mesto='11';} if ($point=='15') {$mesto='12';} if ($point=='14') {$mesto='13';} if ($point=='13') {$mesto='14';} if ($point=='12') {$mesto='15';} if ($point=='10') {$mesto='16';} if ($point=='9') {$mesto='17';} if ($point=='8.5') {$mesto='18';} if ($point=='8') {$mesto='19';} if ($point=='7') {$mesto='20';} if ($point=='6.5') {$mesto='21';} if ($point=='6') {$mesto='22';} if ($point=='5.5') {$mesto='23';} if ($point=='5') {$mesto='24';} if ($point=='4.5') {$mesto='25';} if ($point=='4') {$mesto='26';} if ($point=='3.5') {$mesto='27';} if ($point=='3') {$mesto='28';} if ($point=='2') {$mesto='29';} if ($point=='1.5') {$mesto='30';} if ($point=='0.3') {$mesto='DNF';} } if ($game=='drive') { if ($point=='50') {$mesto='1';} if ($point=='47') {$mesto='2';} if ($point=='44') {$mesto='3';} if ($point=='42') {$mesto='4';} if ($point=='40') {$mesto='5';} if ($point=='38') {$mesto='6';} if ($point=='36') {$mesto='7';} if ($point=='34') {$mesto='8';} if ($point=='32') {$mesto='9';} if ($point=='30') {$mesto='10';} if ($point=='28') {$mesto='11';} if ($point=='26') {$mesto='12';} if ($point=='24') {$mesto='13';} if ($point=='22') {$mesto='14';} if ($point=='20') {$mesto='15';} if ($point=='18') {$mesto='16';} if ($point=='16') {$mesto='17';} if ($point=='14') {$mesto='18';} if ($point=='13') {$mesto='19';} if ($point=='12') {$mesto='20';} if ($point=='11') {$mesto='21';} if ($point=='10') {$mesto='22';} if ($point=='9') {$mesto='23';} if ($point=='8') {$mesto='24';} if ($point=='7') {$mesto='25';} if ($point=='6') {$mesto='26';} if ($point=='5') {$mesto='27';} if ($point=='4') {$mesto='28';} if ($point=='3') {$mesto='29';} if ($point=='2') {$mesto='30';} if ($point=='0.5') {$mesto='DNF';} } if ($game=='q') { if ($point=='80') {$mesto='1';} if ($point=='75') {$mesto='2';} if ($point=='70') {$mesto='3';} if ($point=='67') {$mesto='4';} if ($point=='64') {$mesto='5';} if ($point=='60') {$mesto='6';} if ($point=='57') {$mesto='7';} if ($point=='54') {$mesto='8';} if ($point=='51') {$mesto='9';} if ($point=='48') {$mesto='10';} if ($point=='44') {$mesto='11';} if ($point=='41') {$mesto='12';} if ($point=='38') {$mesto='13';} if ($point=='35') {$mesto='14';} if ($point=='32') {$mesto='15';} if ($point=='28') {$mesto='16';} if ($point=='25') {$mesto='17';} if ($point=='24') {$mesto='18';} if ($point=='21') {$mesto='19';} if ($point=='19') {$mesto='20';} if ($point=='18') {$mesto='21';} if ($point=='16') {$mesto='22';} if ($point=='15') {$mesto='23';} if ($point=='13') {$mesto='24';} if ($point=='12') {$mesto='25';} if ($point=='10') {$mesto='26';} if ($point=='9') {$mesto='27';} if ($point=='7') {$mesto='28';} if ($point=='5') {$mesto='29';} if ($point=='4') {$mesto='30';} if ($point=='1') {$mesto='DNF';} } return $mesto; } function points($mesto) { if ($mesto>0) {$points=30;} if ($mesto>1) {$points=27;} if ($mesto>2) {$points=24;} if ($mesto>3) {$points=22;} if ($mesto>4) {$points=20;} if ($mesto>5) {$points=18;} if ($mesto>6) {$points=16;} if ($mesto>7) {$points=15;} if ($mesto>8) {$points=14;} if ($mesto>9) {$points=13;} if ($mesto>10) {$points=12;} if ($mesto>11) {$points=11;} if ($mesto>12) {$points=10;} if ($mesto>13) {$points=9;} if ($mesto>14) {$points=8;} if ($mesto>15) {$points=7;} if ($mesto>16) {$points=6;} if ($mesto>17) {$points=5;} if ($mesto>18) {$points=4;} if ($mesto>19) {$points=3;} if ($mesto>20) {$points=2;} $points='('.$points.' pts.)'; return $points; }; function pointsug($mesto) { if ($mesto>0) {$pointsug=15;} if ($mesto>1) {$pointsug=13;} if ($mesto>2) {$pointsug=11;} if ($mesto>3) {$pointsug=10;} if ($mesto>4) {$pointsug=9;} if ($mesto>5) {$pointsug=8.5;} if ($mesto>6) {$pointsug=8;} if ($mesto>7) {$pointsug=7.5;} if ($mesto>8) {$pointsug=7;} if ($mesto>9) {$pointsug=6.5;} if ($mesto>10) {$pointsug=6;} if ($mesto>11) {$pointsug=5.5;} if ($mesto>12) {$pointsug=5;} if ($mesto>13) {$pointsug=4.5;} if ($mesto>14) {$pointsug=4;} if ($mesto>15) {$pointsug=3.5;} if ($mesto>16) {$pointsug=3;} if ($mesto>17) {$pointsug=2.5;} if ($mesto>18) {$pointsug=2;} if ($mesto>19) {$pointsug=1.5;} if ($mesto>20) {$pointsug=1;} $pointsug='('.$pointsug.' pts.)'; return $pointsug; } function pointsfive($mesto) { if ($mesto>0) {$pointsfive=50;} if ($mesto>1) {$pointsfive=46;} if ($mesto>2) {$pointsfive=42;} if ($mesto>3) {$pointsfive=39;} if ($mesto>4) {$pointsfive=36;} if ($mesto>5) {$pointsfive=33;} if ($mesto>6) {$pointsfive=30;} if ($mesto>7) {$pointsfive=28;} if ($mesto>8) {$pointsfive=26;} if ($mesto>9) {$pointsfive=24;} if ($mesto>10) {$pointsfive=22;} if ($mesto>11) {$pointsfive=20;} if ($mesto>12) {$pointsfive=18;} if ($mesto>13) {$pointsfive=16;} if ($mesto>14) {$pointsfive=14;} if ($mesto>15) {$pointsfive=12;} if ($mesto>16) {$pointsfive=10;} if ($mesto>17) {$pointsfive=8;} if ($mesto>18) {$pointsfive=6;} if ($mesto>19) {$pointsfive=4;} if ($mesto>20) {$pointsfive=3;} $pointsfive='('.$pointsfive.' pts.)'; return $pointsfive; } function Counter($count) { $img="counter.gif"; $im = imagecreatefromgif ($img); $black = ImageColorAllocate($im, 0, 0, 0); $white = ImageColorAllocate($im, 255, 255, 255); $count=888; ImageString($im , 1, 8, 6, $count, $white); //header ("Content-type: image/gif"); imagegif ($im); } ?>