discourse-legacysite-perl/site/racecalendar/pointlist.php
2024-06-17 22:42:14 +10:00

146 lines
5.3 KiB
PHP

<?PHP include("config.php");
if ($_GET[points] == 'sprint') {
$where = 'points < 40';
$pointname = 'Sprint';
} elseif ($_GET[points] == 'international') {
$where = 'points >= 40 AND points < 100';
$pointname = 'International';
} elseif ($_GET[points] == 'mid') {
$where = 'points >= 100 AND points < 180';
$pointname = 'Mid-Length';
} elseif ($_GET[points] == 'ultra') {
$where = 'points >= 180';
$pointname = 'Ultra';
} else {
header('Location: https://slowtwitch.com/calendar/');
exit();
}
/**Less than 40 points = sprint
40 points to 99 points = international
100 points to 179 points = mid
More than 180 points = ultra**/
/*$results = mysql_query("SELECT gtr.regionlong, gt.onetype, gt.twotype, threetype, oneunit, twounit, threeunit, name, nametag, gt.statetag, swim, bike, run, city, state, uid, UNIX_TIMESTAMP(date) as fooFROM gforum_TriathlonsRegions WHERE gtr.regionid = ".intval(mysql_escape_string($_GET[region]))." LEFT JOIN gforum_TriathlonsStates AS gts ON gts.regionid = gtr.regionid LEFT JOIN gforum_Triathlons AS gt ON gt.statetag = gts.statetag AND valid=1 AND date > '2008-01-01' ORDER BY gt.date ASC");*/
$sql = "SELECT gt.onetype, gt.twotype, gt.threetype, gt.oneunit, gt.twounit, gt.threeunit, gt.name, gt.nametag, gt.statetag, gt.swim, gt.bike, gt.run, gt.city, gt.state, gt.uid, UNIX_TIMESTAMP(gt.date) as foo
FROM gforum_Triathlons AS gt
WHERE valid = 1 AND date > '".$min_date."' AND ".$where." ORDER BY gt.date ASC";
$results = mysql_query($sql);
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
/*$results = mysql_query("SELECT onetype, twotype, threetype, oneunit, twounit, threeunit, name, nametag, statetag, swim, bike, run, city, state, uid, UNIX_TIMESTAMP(date) as foo FROM gforum_Triathlons RIGHT JOIN WHERE regionid='$_GET[region]' AND valid=1 AND date > '2008-01-01' ORDER BY date ASC");**/
// set the page title
$pagetitle = $pointname." Triathlons";
// set meta tags
$meta_keywords = $pointname." distance triathlons";
$meta_description = "Trying to find triathlons or duathlons of ".$pointname." distance? Here is a listing of all ".$pointname." triathlons. Users can even rate and comment on races.";
?>
<? include("include_common_head.php"); ?>
<? include("include_common_content.php"); ?>
<!-- Start outer -->
<div id="outer">
<!-- BODY -->
<div class="content">
<!-- LEFT COLUMN -->
<!-- End left column -->
<!-- Content col -->
<h1 class="content-title"><strong><? echo $pointname; ?> Triathlons</strong></h1>
<div class="indent">
<?
if($none == TRUE){
echo "No ".$pointname."triathlons have been entered yet.";
}
?>
<table border="0" cellspacing="0" cellpadding="1" width="580">
<?
$x = 0;
while($row = mysql_fetch_array($results)){
if($row[type] == 1){ $firstthing = 'swim'; $typename = 'Triathlon'; }else if($row[type] == 2){ $firstthing = 'run'; $typename = 'Duathlon'; }else if($row[type] == 3){ $typename = 'Other'; }
$x++;
if($x % 2 == 0){ $bg = '#dddddd'; }else{ $bg = '#eeeeee'; }
?>
<tr bgcolor="<? echo "$bg"; ?>"><td><br><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "individual.php?uid=$row[uid]"; ?>"><? echo $row[name]; ?></a></td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td><strong class="indent"><? echo date("F j, Y", $row[foo]); ?></strong></td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td><strong class="indent">
<?
if($row[oneunit] == 1){ $oneunit = "mile"; }
if($row[oneunit] == 2){ $oneunit = "meter"; }
if($row[oneunit] == 3){ $oneunit = "yard"; }
if($row[oneunit] == 4){ $oneunit = "kilometers"; }
if($row[twounit] == 1){ $twounit = "mile"; }
if($row[twounit] == 2){ $twounit = "meter"; }
if($row[twounit] == 3){ $twounit = "yard"; }
if($row[twounit] == 4){ $twounit = "kilometers"; }
if($row[threeunit] == 1){ $threeunit = "mile"; }
if($row[threeunit] == 2){ $threeunit = "meter"; }
if($row[threeunit] == 3){ $threeunit = "yard"; }
if($row[threeunit] == 4){ $threeunit = "kilometers"; }
if($row[onetype] == 1){ $onetype = "swim"; }
if($row[onetype] == 2){ $onetype = "bike"; }
if($row[onetype] == 3){ $onetype = "run"; }
if($row[onetype] == 4){ $onetype = "paddle"; }
if($row[onetype] == 5){ $onetype = "ski"; }
if($row[twotype] == 1){ $twotype = "swim"; }
if($row[twotype] == 2){ $twotype = "bike"; }
if($row[twotype] == 3){ $twotype = "run"; }
if($row[twotype] == 4){ $twotype = "paddle"; }
if($row[twotype] == 5){ $twotype = "ski"; }
if($row[threetype] == 1){ $threetype = "swim"; }
if($row[threetype] == 2){ $threetype = "bike"; }
if($row[threetype] == 3){ $threetype = "run"; }
if($row[threetype] == 4){ $threetype = "paddle"; }
if($row[threetype] == 5){ $threetype = "ski"; }
echo "$row[swim] $oneunit $onetype, $row[bike] $twounit $twotype";
if ($row[run] != 0) { echo ", $row[run] $threeunit $threetype"; }
?></strong></td></tr>
<? /* ?>
<tr bgcolor="<? echo "$bg"; ?>"><td><div class="indent"><strong>Description:</strong><br />
<?
if(strlen($row[courseinfo]) > 400){
$phrase = " (...)"; }else{
$phrase = ""; }
echo substr(stripslashes(stripslashes($row[courseinfo])), 0, 400); echo $phrase; ?>
</div></td></tr>
<? */ ?>
<tr bgcolor="<? echo "$bg"; ?>"><td><div class="indent">
<strong>Location:</strong> <? echo "$row[city], $row[state]"; ?><br />
<a class="nav" href="<? echo "individual.php?uid=$row[uid]"; ?>">More information</a>
<br /><br /></div></td></tr>
<? } ?>
</table>
</div>
<!-- End content col -->
</div>
<!-- End BODY -->
</div>
<!-- End Outer -->
<? include("include_common_footer.php"); ?>