Location: PHPKode > projects > GolfstatsPHP > golfstatsphp_3.0/score_functions.inc.php
<?
//this is to ensure that the seqno maintains the leading no
function get_name($par,$score){
  $diff=$score-$par;

	if ($diff==0) {
	$name="Par";
	} elseif ($diff==1) {
	$name="Bogey";
	} elseif ($diff==2) {
	$name="Double Bogey";
	} elseif ($diff==3) {
	$name="Triple Bogey";
	} elseif ($diff>3) {
	$name="Others";
	} elseif ($diff==-1) {
	$name="Birdie";	
	} elseif ($diff==-2) {
	
	if ($par == 3) { $name="Hole in one"; 
	} else {
	$name="Eagle";
	}
	
	} elseif ($diff==-3) {
	
	if ($par == 4) { $name="Hole in one"; 
	} else {
	$name="Double Eagle";
	
	} 
	
	} elseif ($diff==-4) {
	
	if ($par == 5) { $name="Hole in one"; 
	} else {
	$name="Double Eagle";

	}	
	
	}
  return($name);
  }//end function





//special function to count rate given the duration and the rate number;
function count_net($handicap,$score,$index) {

if ($handicap > 18) {
$twostroke=$handicap-18;
$onestroke=$twostroke+1;

    if ($index <= $twostroke) {
		$netscore=$score-2;
		} elseif ($index >$twostroke) {
		$netscore=$score-1;
		}




} elseif ($handicap == 18) {
$onestroke=18;
     $netscore=$score-1;

} elseif ($handicap < 18) {
$onestroke=$handicap;

     if ($index <=$onestroke) {
		 $netscore=$score-1;
		 } else {
		 $netscore=$score;
		 }
}




return ($netscore);
}//end function



?>
Return current item: GolfstatsPHP