include("include_common_head.php"); ?>
include("include_common_content.php"); ?>
//Array of states for use in the form
$state_list = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AB'=>'Alberta',
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'BC'=>'British Columbia',
'CB'=>"Caribbean",
'CA'=>"California",
'CM'=>"Central America",
'CO'=>"Colorado",
'CT'=>"Connecticut",
'DE'=>"Delaware",
'DC'=>"District of Columbia",
'FL'=>"Florida",
'GA'=>"Georgia",
'HI'=>"Hawaii",
'ID'=>"Idaho",
'IL'=>"Illinois",
'IN'=>"Indiana",
'IA'=>"Iowa",
'KS'=>"Kansas",
'KY'=>"Kentucky",
'LA'=>"Louisiana",
'ME'=>"Maine",
'MB'=>'Manitoba',
'MD'=>"Maryland",
'MA'=>"Massachusetts",
'MX'=>"Mexico",
'MI'=>"Michigan",
'MN'=>"Minnesota",
'MS'=>"Mississippi",
'MO'=>"Missouri",
'MT'=>"Montana",
'NE'=>"Nebraska",
'NV'=>"Nevada",
'NB'=>'New Brunswick',
'NL'=>'Newfoundland',
'NH'=>"New Hampshire",
'NJ'=>"New Jersey",
'NM'=>"New Mexico",
'NY'=>"New York",
'NC'=>"North Carolina",
'ND'=>"North Dakota",
'NS'=>'Nova Scotia',
'OH'=>"Ohio",
'OK'=>"Oklahoma",
'ON'=>'Ontario',
'OR'=>"Oregon",
'PA'=>"Pennsylvania",
'PE'=>'Prince Edward Island',
'QC'=>'Quebec',
'RI'=>"Rhode Island",
'SK'=>'Saskatchewan',
'SC'=>"South Carolina",
'SD'=>"South Dakota",
'TN'=>"Tennessee",
'TX'=>"Texas",
'UT'=>"Utah",
'VT'=>"Vermont",
'VA'=>"Virginia",
'WA'=>"Washington",
'WV'=>"West Virginia",
'WI'=>"Wisconsin",
'WY'=>"Wyoming");
// Populate with post data or populate with edit return data
if (isset($_POST[edit_return])) {
$row = $_POST;
$row[racedate] = strtotime($row[racedate]);
} else {
$uid = intval(mysql_escape_string($_GET[uid]));
$results = mysql_query("SELECT onetype, twotype, threetype, oneunit, twounit, threeunit, results, pic1, pic2, pic3, uid, name, nametag, type, indivfee, teamfee, swim, bike, run, state, statetag, city, address, phone, email, courseinfo, moreinfo, directions, register, website, submitted_by, valid, UNIX_TIMESTAMP(date) AS racedate, uid AS uid FROM gforum_Triathlons WHERE uid='".$uid."'");
$row = mysql_fetch_array($results);
}
if(is_logged_in($user)){
//Get user's uid
$username = base64_decode($_SESSION['user']);
$testresults = mysql_query("SELECT user_id FROM ".$prefix."User WHERE user_username='$username'") or die(mysql_error());
$testrow = mysql_fetch_array($testresults);
$useruid = $testrow[user_id];
$race_owner = FALSE;
// is the current user the owner of the race?
if($useruid == $row[submitted_by] && $row[valid] == 1){
$race_owner = TRUE;
}
if(!is_admin() && $race_owner != TRUE) {
header('Location:https://slowtwitch.com/calendar/');
exit();
}
} else {
header('Location:https://slowtwitch.com/calendar/');
exit();
}
?>
Edit a Race
To edit a race, simply change the data you wish. If you make a mistake, just hit the reset button. To save the changes to a NEW race, hit the "CREATE NEW RACE" button. To save changes to the existing race, hit the "SAVE CHANGES" button. You will have a chance to review the data before confirming.
include("include_common_footer.php"); ?>