Overall‘ : ‘
Overall‘;
}
$text .= $_GET[‘ages’] == ‘show’ ? $nbsp . ‘Age Groups‘ : $nbsp . ‘Age Groups‘;
$count += 1;
}
if ($_SESSION[‘irunutah’] == ‘true’) {
if ($count == 0) {
$text .= $_GET[‘ages’] == ‘show’ ? ‘
$tpos $gpos " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' '; //prepare to echo the major result fields
if ($meta['team'] == 'on') {
$s .= '' . $ar['team'] . ' ';
} //show team if meta['team'] is checked
if ($meta['pace'] == 'on') { //if meta['pace'] is checked, calculate and show pace
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
$s .= 'unknown ';
} else {
$s .= '' . getpace($el, $meta['pace' . str_replace(' ', '', strtolower($ar['division']))]) . ' ';
}
}
if ($meta['showsplit11'] == 'on') {
$gun = date_create($ar['gunstart']);
$s1 = date_create($ar['split11']);
$s .= $ar['split11'] == '00:00:00.000' ? ' ' : '' . @date_diff($gun, $s1)->format("%h:%I:%S") . ' ';
}
if ($meta['parsedsplits'] == 'on') {
if ($ar['chipstart'] == '0') {
$ar['chipstart'] = '00:00:00';
}
if ($ar['split11'] == '0') {
$ar['split11'] = '00:00:00';
}
if ($ar['split2'] == '0') {
$ar['split2'] = '00:00:00';
}
if ($ar['split3'] == '0') {
$ar['split3'] = '00:00:00';
}
if ($ar['split4'] == '0') {
$ar['split4'] = '00:00:00';
}
if ($ar['finish'] == '0') {
$ar['finish'] = '00:00:00';
}
if ($meta['chipelapsed'] == 'on') {
$f = 'chipstart';
} else {
$f = 'gunstart';
}
$chipstart = date_create($ar[$f]);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = @date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = @date_diff($s1, $s2)->format("%h:%I:%S");
$bike = @date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = @date_diff($s4, $s3)->format("%h:%I:%S");
$run = @date_diff($fin, $s4)->format("%h:%I:%S");
$s .= "$swim $tt1 $bike $tt2 $run ";
}
$s .= " ";
if ($el != '0' && $el != '00:00:00' && $el != '00:00') {
$ss .= $s;
if (!in_array($ar['division'], $divisions0)) {
$divisions0[] = $ar['division'];
}
} else {
$pos -= 1;
if ($ar['gender'] == 'M') {
$mpos -= 1;
} else {
$fpos -= 1;
}
} //if elapsed time is not 0, show the field. otherwise, take one away from both overall ranking and gender ranking
}
echo $ss . ''; //close the table
} else { //Age Groups
echo genNavi($meta, $id);
echo '';
if ($meta['showages'] == 'on') {
if ($meta['chipelapsed'] == 'on') {
$sort = 'chipelapsed';
} else {
$sort = 'gunelapsed';
}
if ($meta['sepbydiv'] == 'on') {
$sepbydiv = 'division,';
} else {
$sepbydiv = '';
}
$excludes = '';
$exclude = explode(',', $meta['exclude']);
$p = 0;
while ($p < count($exclude)) {
$excludes .= " AND NOT lower(division)='" . $exclude[$p] . "'";
$p += 1;
}
$res = mysqli_query($db, "SELECT * FROM " . $id . "results WHERE NOT " . $sort . "='0'" . $excludes . " ORDER BY " . $sepbydiv . "gender,agesort,agegroup," . $sort);
$lastage = 'nohaynada';
$pos = 1;
$divi = @mysqli_query($db, "SELECT * FROM " . $id . "div WHERE age='F' ");
$prohibitedn = 0;
$prohibited[0] = '';
while ($d = mysqli_fetch_array($divi)) {
$prohibited[] = $d['division'];
}
$ts = '
" . $pos . " " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' ';
if ($meta['team'] == 'on') {
echo '' . $ar['team'] . ' ';
}
if ($meta['showsplit11'] == 'on') {
echo $ar['split11'] == '00:00:00.000' ? ' ' : '' . $ar['split11'] . ' ';
}
if ($meta['pace'] == 'on') {
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
echo 'unknown ';
} else {
echo '' . getpace($el, $dist) . ' ';
}
}
if ($meta['parsedsplits'] == 'on') {
if ($ar['chipstart'] == '0') {
$ar['chipstart'] = '00:00:00';
}
if ($ar['split11'] == '0') {
$ar['split11'] = '00:00:00';
}
if ($ar['split2'] == '0') {
$ar['split2'] = '00:00:00';
}
if ($ar['split3'] == '0') {
$ar['split3'] = '00:00:00';
}
if ($ar['split4'] == '0') {
$ar['split4'] = '00:00:00';
}
if ($ar['finish'] == '0') {
$ar['finish'] = '00:00:00';
}
if ($meta['chipelapsed'] == 'on') {
$f = 'chipstart';
} else {
$f = 'gunstart';
}
$chipstart = date_create($ar[$f]);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = @date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = @date_diff($s1, $s2)->format("%h:%I:%S");
$bike = @date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = @date_diff($s4, $s3)->format("%h:%I:%S");
$run = @date_diff($fin, $s4)->format("%h:%I:%S");
echo "$swim $tt1 $bike $tt2 $run ";
}
echo ' ';
$pos += 1;
}
echo '';
} else { //display overall winners for a race with results separated by division
$divres = mysqli_query($db, "SELECT * FROM " . $id . "div WHERE NOT LOWER(division)='dq' AND NOT LOWER(division)='dnf' AND NOT LOWER(division)='dns'" . $excludes);
while ($div = mysqli_fetch_array($divres)) {
if (!in_array($div['division'], $prohibited)) {
$topmale = mysqli_query($db, "SELECT * FROM " . $id . "results WHERE division='" . $div['division'] . "' AND gender='M' AND NOT " . $sort . "='0' ORDER BY " . $sort . " LIMIT 3");
$topfemale = mysqli_query($db, "SELECT * FROM " . $id . "results WHERE division='" . $div['division'] . "' AND gender='F' AND NOT " . $sort . "='0' ORDER BY " . $sort . " LIMIT 3");
echo '" . $pos . " " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' ';
if ($meta['team'] == 'on') {
echo '' . $ar['team'] . ' ';
}
if ($meta['showsplit11'] == 'on') {
echo $ar['split11'] == '00:00:00.000' ? ' ' : '' . $ar['split11'] . ' ';
}
if ($meta['pace'] == 'on') {
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
echo 'unknown ';
} else {
echo '' . getpace($el, $dist) . ' ';
}
}
if ($meta['parsedsplits'] == 'on') {
if ($ar['chipstart'] == '0') {
$ar['chipstart'] = '00:00:00';
}
if ($ar['split11'] == '0') {
$ar['split11'] = '00:00:00';
}
if ($ar['split2'] == '0') {
$ar['split2'] = '00:00:00';
}
if ($ar['split3'] == '0') {
$ar['split3'] = '00:00:00';
}
if ($ar['split4'] == '0') {
$ar['split4'] = '00:00:00';
}
if ($ar['finish'] == '0') {
$ar['finish'] = '00:00:00';
}
if ($meta['chipelapsed'] == 'on') {
$f = 'chipstart';
} else {
$f = 'gunstart';
}
$chipstart = date_create($ar[$f]);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = @date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = @date_diff($s1, $s2)->format("%h:%I:%S");
$bike = @date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = @date_diff($s4, $s3)->format("%h:%I:%S");
$run = @date_diff($fin, $s4)->format("%h:%I:%S");
echo "$swim $tt1 $bike $tt2 $run ";
}
echo ' ';
$pos += 1;
}
$pos = 1;
echo '" . $pos . " " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' ';
if ($meta['team'] == 'on') {
echo '' . $ar['team'] . ' ';
}
if ($meta['showsplit11'] == 'on') {
echo $ar['split11'] == '00:00:00.000' ? ' ' : '' . $ar['split11'] . ' ';
}
if ($meta['pace'] == 'on') {
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
echo 'unknown ';
} else {
echo '' . getpace($el, $dist) . ' ';
}
}
if ($meta['parsedsplits'] == 'on') {
if ($ar['chipstart'] == '0') {
$ar['chipstart'] = '00:00:00';
}
if ($ar['split11'] == '0') {
$ar['split11'] = '00:00:00';
}
if ($ar['split2'] == '0') {
$ar['split2'] = '00:00:00';
}
if ($ar['split3'] == '0') {
$ar['split3'] = '00:00:00';
}
if ($ar['split4'] == '0') {
$ar['split4'] = '00:00:00';
}
if ($ar['finish'] == '0') {
$ar['finish'] = '00:00:00';
}
if ($meta['chipelapsed'] == 'on') {
$f = 'chipstart';
} else {
$f = 'gunstart';
}
$chipstart = date_create($ar[$f]);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = @date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = @date_diff($s1, $s2)->format("%h:%I:%S");
$bike = @date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = @date_diff($s4, $s3)->format("%h:%I:%S");
$run = @date_diff($fin, $s4)->format("%h:%I:%S");
echo "$swim $tt1 $bike $tt2 $run ";
}
echo ' ';
$pos += 1;
}
echo '';
}
}
}
$lastdiv = 'nohaynada';
$pos = 1;
while ($ar = mysqli_fetch_array($res)) { //for each bib
if ($meta['sepbydiv'] == 'on') {
if ($lastdiv == 'nohaynada') {
$sn = $ts;
$lastdiv = strtolower($ar['division']);
} else {
if (strtolower($lastdiv) != strtolower($ar['division'])) {
$sn = $ss . 'Overall Winner " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' ';
if ($meta['team'] == 'on') {
$s .= '' . $ar['team'] . ' ';
}
if ($meta['showsplit11'] == 'on') {
$s .= $ar['split11'] == '00:00:00.000' ? ' ' : '' . $ar['split11'] . ' ';
}
if ($meta['pace'] == 'on') {
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
$s .= 'unknown ';
} else {
$s .= '' . getpace($el, $dist) . ' ';
}
}
if ($meta['parsedsplits'] == 'on') {
$chipstart = date_create($ar['chipstart']);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = date_diff($s1, $s2)->format("%h:%I:%S");
$bike = date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = date_diff($s4, $s3)->format("%h:%I:%S");
$run = date_diff($fin, $s4)->format("%h:%I:%S");
$s .= "$swim $tt1 $bike $tt2 $run ";
}
$s .= ' ';
} else {
$s = "$tpos " . ucwords(strtolower($ar['name'])) . ' ' . $el . ' #' . $ar['bib'] . ' ' . strtoupper($ar['gender']) . ' ' . $ar['age'] . ' ';
if ($meta['team'] == 'on') {
$s .= '' . $ar['team'] . ' ';
}
if ($meta['pace'] == 'on') {
$dist = $meta['pace' . str_replace(' ', '', strtolower($ar['division']))];
if ($dist == 0) {
$s .= 'unknown ';
} else {
$s .= '' . getpace($el, $dist) . ' ';
}
}
if ($meta['parsedsplits'] == 'on') {
if ($ar['chipstart'] == '0') {
$ar['chipstart'] = '00:00:00';
}
if ($ar['split11'] == '0') {
$ar['split11'] = '00:00:00';
}
if ($ar['split2'] == '0') {
$ar['split2'] = '00:00:00';
}
if ($ar['split3'] == '0') {
$ar['split3'] = '00:00:00';
}
if ($ar['split4'] == '0') {
$ar['split4'] = '00:00:00';
}
if ($ar['finish'] == '0') {
$ar['finish'] = '00:00:00';
}
if ($meta['chipelapsed'] == 'on') {
$f = 'chipstart';
} else {
$f = 'gunstart';
}
$chipstart = date_create($ar[$f]);
$s1 = date_create($ar['split11']);
$s2 = date_create($ar['split2']);
$s3 = date_create($ar['split3']);
$s4 = date_create($ar['split4']);
$fin = date_create($ar['finish']);
$swim = @date_diff($chipstart, $s1)->format("%h:%I:%S");
$tt1 = @date_diff($s1, $s2)->format("%h:%I:%S");
$bike = @date_diff($s3, $s2)->format("%h:%I:%S");
$tt2 = @date_diff($s4, $s3)->format("%h:%I:%S");
$run = @date_diff($fin, $s4)->format("%h:%I:%S");
$s .= "$swim $tt1 $bike $tt2 $run ";
}
$s .= ' ';
}
if ($el != '0' && $ar['gender'] != '' && !in_array($ar['division'],$prohibited)) {
if (!in_array($ar['division'], $divisions0)) {
$divisions0[] = $ar['division'];
}
echo $sn;
$sn = '';
echo $s;
$pos += 1;
}
}
echo '';
}
}
?>
Overall‘ : ‘
‘; if ($count > 9) { $text .= ‘
‘; } return $text; } } $db = mysqli_connect(‘localhost’, ‘irunutah_admin’, ‘Weinnov8!’, ‘irunutah_races’); $res = mysqli_query($db, “SELECT * FROM races WHERE id='” . $_GET[‘id’] . “‘ LIMIT 1”); $races = mysqli_fetch_array($res); $divisions0 = array(); echo ‘See All Results
‘; } ?> Search by bib number:
';
if (!isset($_GET['sort']) || $_GET['sort'] == '') {
if ($meta['chipelapsed'] == 'on') {
$sort = 'chipelapsed';
} else {
$sort = 'gunelapsed';
}
} else {
$sort = mysqli_real_escape_string($db, str_replace("'", '', $_GET['sort']));
}
if ($meta['sepbydiv'] == 'on') {
$sepbydiv = 'division,';
} else {
$sepbydiv = '';
}
$res = mysqli_query($db, "SELECT * FROM " . $id . "results WHERE NOT finish='0' ORDER BY " . $sepbydiv . $sort);
$mpos = 0;
$fpos = 0;
$pos = 0;
$lastdiv = 'nohaynada';
$ss = '';
$start = 'Overall‘;
}
$text .= $nbsp . ‘Finish Order‘;
$count += 1;
}
if ($m[‘extrasort’] != ” && $_GET[‘ages’] != ‘show’) {
$ee = $m[‘chipelapsed’] == ‘on’ ? ‘chipelapsed’ : ‘gunelapsed’;
$s = explode(‘,’, str_replace($ee . ‘,’, ”, $m[‘extrasort’]));
$nice = array(
“gunelapsed” => “Gun Elapsed”,
“chipelapsed” => “Chip Elapsed”,
“finish” => “Finish”,
“split11” => “Split 1”,
“bib” => “Bib”,
“name” => “Name”,
“swim” => “Swim”,
“bike” => “Bike”,
“run” => “Run”,
“tt1” => “Transition 1”,
“tt2” => “Transition 2”
);
$i = 0;
$text .= ‘
Sort By ‘; $count += 10; } if ($count > 0) { $text .= ‘
Sort By ‘; $count += 10; } if ($count > 0) { $text .= ‘
‘; if ($count > 9) { $text .= ‘
‘; } return $text; } } $db = mysqli_connect(‘localhost’, ‘irunutah_admin’, ‘Weinnov8!’, ‘irunutah_races’); $res = mysqli_query($db, “SELECT * FROM races WHERE id='” . $_GET[‘id’] . “‘ LIMIT 1”); $races = mysqli_fetch_array($res); $divisions0 = array(); echo ‘See All Results
‘ . $races[‘racename’] . ‘ ‘ . date(‘Y’, strtotime($races[‘date’])) . ‘
‘; function fixDivID($str) { $one = preg_replace(“/[)]+/”, “.”, $str); $two = preg_replace(“/[(]+/”, “,”, $one); return preg_replace(“/[^\w().,]+/”, “_”, $two); } if ($_SESSION[‘irunutah’] == ‘true’) { echo ‘Edit Results‘; } ?> Search by bib number:
Rank | Gender Rank | Name | Elapsed Time | Bib | Gender | Age | '; if ($meta['team'] == 'on') { $start .= "Team | "; } if ($meta['pace'] == 'on') { $start .= 'Pace (min/mi) | '; } if ($meta['showsplit11'] == 'on') { $start .= "Split 1 | "; } if ($meta['parsedsplits'] == 'on') { $start .= 'Swim | T1 | Bike | T2 | Run | '; } $start .= "
---|
' . str_replace('( ', '(', ucwords(strtolower(str_replace('(', '( ', $ar['division'])))) . '
' . $start; $ss = ''; $lastdiv = $ar['division']; $pos = 0; $mpos = 0; $fpos = 0; } } } else { if ($lastdiv == 'nohaynada') { echo $start; $lastdiv = ''; } } if ($ar['gender'] == 'M') { $mpos += 1; $gpos = $mpos; } //get rankings and gender rankings if ($ar['gender'] == 'F') { $fpos += 1; $gpos = $fpos; } if ($ar['gender'] == '') { $gpos = 'unknown'; } $pos += 1; $tpos = $pos; if ($meta['chipelapsed'] == 'on') { $el = $ar['chipelapsed']; } else { $el = $ar['gunelapsed']; } if (substr($el, 0, 3) == '00:') { $el = substr($el, 3); } //get elapsed time and format it. $s = "Rank | Name | Elapsed Time | Bib | Gender | Age | '; if ($meta['team'] == 'on') { $ss .= "Team | "; } if ($meta['showsplit11'] == 'on') { $ss .= "Split 1 | "; } if ($meta['pace'] == 'on') { $ts .= "Pace (min/mi) | "; } if ($meta['parsedsplits'] == 'on') { $ts .= 'Swim | T1 | Bike | T2 | Run | '; } $ts .= "||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
" . $pos . " | " . ucwords(strtolower($ar['name'])) . ' | ' . $el . ' | #' . $ar['bib'] . ' | ' . strtoupper($ar['gender']) . ' | ' . $ar['age'] . ' | '; if ($meta['team'] == 'on') { echo '' . $ar['team'] . ' | '; } if ($meta['showsplit11'] == 'on') { echo $ar['split11'] == '00:00:00.000' ? '' : ' | ' . $ar['split11'] . ' | '; } if ($meta['pace'] == 'on') { $dist = $meta['pace' . str_replace(' ', '', $ar['division'])]; if ($dist == 0) { echo 'unknown | '; } else { sscanf($el, "%d:%d:%d", $hours, $minutes, $seconds); $time_seconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes; $pace_seconds = $time_seconds / $meta['pace' . $ar['division']]; $finalpace = gmdate("i:s", $pace_seconds) . '' . $finalpace . ' | '; } } if ($meta['parsedsplits'] == 'on') { if ($ar['chipstart'] == '0') { $ar['chipstart'] = '00:00:00'; } if ($ar['split11'] == '0') { $ar['split11'] = '00:00:00'; } if ($ar['split2'] == '0') { $ar['split2'] = '00:00:00'; } if ($ar['split3'] == '0') { $ar['split3'] = '00:00:00'; } if ($ar['split4'] == '0') { $ar['split4'] = '00:00:00'; } if ($ar['finish'] == '0') { $ar['finish'] = '00:00:00'; } if ($meta['chipelapsed'] == 'on') { $f = 'chipstart'; } else { $f = 'gunstart'; } $chipstart = date_create($ar[$f]); $s1 = date_create($ar['split11']); $s2 = date_create($ar['split2']); $s3 = date_create($ar['split3']); $s4 = date_create($ar['split4']); $fin = date_create($ar['finish']); $swim = @date_diff($chipstart, $s1)->format("%h:%I:%S"); $tt1 = @date_diff($s1, $s2)->format("%h:%I:%S"); $bike = @date_diff($s3, $s2)->format("%h:%I:%S"); $tt2 = @date_diff($s4, $s3)->format("%h:%I:%S"); $run = @date_diff($fin, $s4)->format("%h:%I:%S"); echo "$swim | $tt1 | $bike | $tt2 | $run | "; } echo '