include("include_common_head.php"); ?>
include("include_common_content.php"); ?>
//Array of states for use in the form
//Array of states for use in the form
$state_list = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'CA'=>"California",
'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",
'MD'=>"Maryland",
'MA'=>"Massachusetts",
'MI'=>"Michigan",
'MN'=>"Minnesota",
'MS'=>"Mississippi",
'MO'=>"Missouri",
'MT'=>"Montana",
'NE'=>"Nebraska",
'NV'=>"Nevada",
'NH'=>"New Hampshire",
'NJ'=>"New Jersey",
'NM'=>"New Mexico",
'NY'=>"New York",
'NC'=>"North Carolina",
'ND'=>"North Dakota",
'OH'=>"Ohio",
'OK'=>"Oklahoma",
'OR'=>"Oregon",
'PA'=>"Pennsylvania",
'RI'=>"Rhode Island",
'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");
/** THIS SECTION DISPLAYS THE DATA FOR CONFIRMATION **/
// Need to interlace this with the edit / upload / copy screen from above.
/**if($deletepics == 1){
//delete pictures uploaded
$file1 = $picname1;
$file2 = $picname2;
$file3 = $picname3;
$file1 = stripslashes(str_replace("\"", "", $file1));
$file2 = stripslashes(str_replace("\"", "", $file2));
$file3 = stripslashes(str_replace("\"", "", $file3));
$file1 = "/srv/www/htdocs/trifind/racepics/$file1.img";
$file2 = "/srv/www/htdocs/trifind/racepics/$file2.img";
$file3 = "/srv/www/htdocs/trifind/racepics/$file3.img";
if(file_exists($file1)){ unlink($file1); }
if(file_exists($file2)){ unlink($file2); }
if(file_exists($file3)){ unlink($file3); }
}**/
$errmsg = NULL;
//Check for blank fields
if ((!$_POST[name])) $errmsg = $errmsg.'Race name, ';
if ($_POST[month]==0) $errmsg = $errmsg.'Race month, ';
if ($_POST[day]==0) $errmsg = $errmsg.'Race day, ';
if ($_POST[type]==0) $errmsg = $errmsg.'Race type, ';
if (!$_POST[indivfee]) $errmsg = $errmsg.'Individual entry fee, ';
if (!$_POST[swim]) $errmsg = $errmsg.'1st event distance, ';
if (!$_POST[bike]) $errmsg = $errmsg.'2nd event distance, ';
//if (!$_POST[run]) $errmsg = $errmsg.'3rd event distance, ';
if (!$_POST[state]) $errmsg = $errmsg.'State, ';
if (!$_POST[city]) $errmsg = $errmsg.'City, ';
if (!$_POST[address]) $errmsg = $errmsg.'Address, ';
if (!$_POST[phone]) $errmsg = $errmsg.'Phone, ';
if (!$_POST[email]) $errmsg = $errmsg.'Email, ';
if (strlen($_POST[courseinfo]) < 4) $errmsg = $errmsg.'Course info, ';
if (strlen($_POST[moreinfo]) < 4) $errmsg = $errmsg.'More info, ';
if (strlen($_POST[directions]) < 4) $errmsg = $errmsg.'Directions, ';
if (!$_POST[website]) $errmsg = $errmsg.'Website, ';
if (isset($errmsg)) {
$errmsg = 'The following fields cannot be left blank: '.$errmsg;
$errmsg = rtrim($errmsg, ', ');
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[name]) ) {
// Contains invalid characters.
$errmsg = "Please use only letters and numbers in the name";
}
$name = trim($_POST[name]);
$nametag = strtolower(str_replace(" ","", $name));
if(strlen($nametag) > 12){ //Shorten it
$nametag = substr($nametag, 0, 12);
}
$hour = $_POST[hour];
if($_POST[daypart] == 1){ $hour = $hour + 12; }
$state = $_POST[state];
$statetag = strtolower(str_replace(" ","", $state));
$type = $_POST[type];
$indivfee = trim($_POST[indivfee]);
$teamfee = trim($_POST[teamfee]);
$swim = $_POST[swim];
$oneunit = $_POST[oneunit];
$twounit = $_POST[twounit];
$threeunit = $_POST[threeunit];
$onetype = $_POST[onetype];
$twotype = $_POST[twotype];
$threetype = $_POST[threetype];
$bike = $_POST[bike];
$run = $_POST[run];
$city = trim($_POST[city]);
$address = trim($_POST[address]);
$phone = trim($_POST[phone]);
$email = trim($_POST[email]);
$courseinfo = nl2br(substr(trim($_POST[courseinfo]), 0, 4096));
$moreinfo = nl2br(substr(trim($_POST[moreinfo]), 0, 4096));
$directions = nl2br(substr(trim($_POST[directions]), 0, 4096));
$register = trim($_POST[register]);
$website = trim($_POST[website]);
$results = trim($_POST[results]);
$sixresults = trim($_POST[sixresults]);
$minute = $_POST[minute];
$year = $_POST[year];
$month = $_POST[month];
$day = $_POST[day];
$date = "$year-$month-$day $hour:$minute:00";
$uid = $_POST[uid];
if($type == 1){ $typename = 'Triathlon'; }
if($type == 2){ $typename = 'Duathlon'; }
if($type == 3){ $typename = 'Other'; }
?>
Edit a Race
if(!$errmsg){ ?>Please confirm your race information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your race information before submitting. } else { echo $errmsg; } ?>
echo stripslashes($name); ?>
$nametagmod = trim(strtolower(str_replace(" ","",$name)));
$nametagmod1 = $nametagmod . '1';
$nametagmod2 = $nametagmod . '2';
$nametagmod3 = $nametagmod . '3';
?>
Date: | echo "$month/$day/$year"; ?> |
Race Type: | echo $typename; ?> |
if($oneunit == 1){ $oneunitword = "mile"; }
if($oneunit == 2){ $oneunitword = "meter"; }
if($oneunit == 3){ $oneunitword = "yard"; }
if($oneunit == 4){ $oneunitword = "kilometers"; }
if($twounit == 1){ $twounitword = "mile"; }
if($twounit == 2){ $twounitword = "meter"; }
if($twounit == 3){ $twounitword = "yard"; }
if($twounit == 4){ $twounitword = "kilometers"; }
if($threeunit == 1){ $threeunitword = "mile"; }
if($threeunit == 2){ $threeunitword = "meter"; }
if($threeunit == 3){ $threeunitword = "yard"; }
if($threeunit == 4){ $threeunitword = "kilometers"; }
if($onetype == 1){ $onetypeword = "swim"; }
if($onetype == 2){ $onetypeword = "bike"; }
if($onetype == 3){ $onetypeword = "run"; }
if($onetype == 4){ $onetypeword = "paddle"; }
if($onetype == 5){ $onetypeword = "ski"; }
if($twotype == 1){ $twotypeword = "swim"; }
if($twotype == 2){ $twotypeword = "bike"; }
if($twotype == 3){ $twotypeword = "run"; }
if($twotype == 4){ $twotypeword = "paddle"; }
if($twotype == 5){ $twotypeword = "paddle"; }
if($threetype == 1){ $threetypeword = "swim"; }
if($threetype == 2){ $threetypeword = "bike"; }
if($threetype == 3){ $threetypeword = "run"; }
if($threetype == 4){ $threetypeword = "paddle"; }
if($threetype == 5){ $threetypeword = "ski"; }
?>
Course: | echo "$swim $oneunitword $onetypeword, $bike $twounitword $twotypeword";
if ($run != 0) { echo ", $run $threeunitword $threetypeword"; }
?> |
Start: | echo "$hour:$minute"; ?> |
Location: | echo stripslashes($city); echo ", $state"; ?> |
Address: | echo stripslashes($address); ?> |
Contact: | echo stripslashes($phone); echo " "; echo stripslashes($email); ?> |
Individual Price: | echo stripslashes($indivfee); ?> |
Team Price: | echo stripslashes($teamfee); ?> |
Course Info: | echo stripslashes($courseinfo); ?> |
More: | echo stripslashes($moreinfo); ?> |
Directions: | echo stripslashes($directions); ?> |
Register: | echo "Click here"; ?> |
Website: | echo "$name"; ?> |
include("include_common_footer.php"); ?>