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

131 lines
5.5 KiB
PHP

<?PHP include("config.php");
if(!is_admin($user)){
header('Location:https://slowtwitch.com/calendar/');
exit();
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT onetype, twotype, threetype, oneunit, twounit, threeunit, name, nametag, statetag, swim, bike, bike_surface, run, city, state, uid, UNIX_TIMESTAMP(date) as foo FROM gforum_Triathlons WHERE valid = 0 AND date > '".$min_date."' ORDER BY date ASC");
// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }
// set the page title
$pagetitle = "Admin: Race Validation";
// set meta tags
$meta_keywords = "";
$meta_description = "";
?>
<? include("include_common_head.php"); ?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="content-title"><strong>Unvalidated Triathlons</strong></h1>
<form method="post" action="validate_X.php" enctype="multipart/form-data">
<?
if($none == TRUE){
echo "There are no races waiting to be validated.";
}
?>
<div class="dtable">
<?
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'; }
?>
<div class="drow"><div class="dcell">
<a href="<? echo "individual.php?uid=$row[uid]"; ?>"><? echo $row[name]; ?></a>
<br>Date: <? echo date("F j, Y", $row[foo]); ?>
</div></div>
<div class="drow"><div class="dcell">
<?
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[twotype] == 1){ $twotype = "swim"; }
if($row[twotype] == 2){ $twotype = "bike"; }
if($row[twotype] == 3){ $twotype = "run"; }
if($row[twotype] == 4){ $twotype = "paddle"; }
if($row[threetype] == 1){ $threetype = "swim"; }
if($row[threetype] == 2){ $threetype = "bike"; }
if($row[threetype] == 3){ $threetype = "run"; }
if($row[threetype] == 4){ $threetype = "paddle"; }
echo "$row[swim] $oneunit $onetype, $row[bike] $twounit $twotype";
if ($row[run] != 0) { echo ", $row[run] $threeunit $threetype"; }
?></div></div>
<div class="drow"><div class="dcell" style="border-bottom: 1px solid #a4a4a4">
<? //Determine bike surface
if ($row[bike_surface] == 1) { $bike_surface = "Offroad"; }
else { $bike_surface = "Road"; }
?>
<strong>Bike Surface:</strong> <? echo $bike_surface; ?>
<br />
<strong>Location:</strong> <? echo "$row[city], $row[state]"; ?><br />
<a class="nav" href="individual.php?uid=<? echo $row[uid] ?>">More information</a>
<br /><input type="checkbox" value="<? echo($row[uid]); ?>" name="validate[]"> Validate this race. <input type="checkbox" value="<? echo($row[uid]); ?>" name="delete[]"> Delete this race.
</div></div>
<? } ?>
</div>
<p>
<input type="submit" value="Process Selected Races" class="btn">
</p>
</form>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>