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

353 lines
17 KiB
PHP

<?PHP
include("config.php");
if(!isset($_GET[triclub_id]) AND !$_POST AND !is_numeric($_GET[triclub_id])) {
header('Location: '.$site_url.'/?error=no_id_or_no_post');
exit();
}
if(!is_logged_in($user)){
header('Location: '.$site_url.'/?error=not_logged_in_one');
exit();
}
// Populate with post data or populate with edit return data
if (isset($_POST[edit_return]) || isset($_POST[edit_club])) {
$row = $_POST;
} else {
$triclub_idhere = mysql_real_escape_string($_GET[triclub_id]);
$results = mysql_query("SELECT * FROM ".$prefix."Triclubs WHERE triclub_id=".$triclub_idhere);
$row = mysql_fetch_array($results);
}
//Get user's session data information
$username = base64_decode($_SESSION['user']);
$useruid = base64_decode($_SESSION['user_id']);
if ( !is_admin() && $row[triclub_valid] != 1 ) {
//echo "row: ".$row[triclub_valid];
header('Location: '.$site_url.'/?error=club_not_valid');
exit();
}
// set the page title
$pagetitle = "Edit A Triathlon Club";
// set meta tags
$meta_keywords = "edit a triathlon club";
$meta_description = "edit screen for triathlon club information";
?>
<?
if($row[edit_club] == 1){
include("wiki_edit_X.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");
?>
<? 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 section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<? if( $_GET[confirmed] == "yes" ) { ?>
<h1>Thank you</h1>
<? echo "<p>Thank you. Your club should be added within 24 hours. You will now be redirected back to the add page.</p>";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=add.php\">";
} else if($confirm == 1){ ?>
<h1>Edit a Club: Step 2 of 2</h1>
<? } else if( ($confirm !=1) && ($row[confirm_entry] != 1)){ ?>
<h1>Edit a Club: Step 1 of 2</h1>
<? } else if( ($row[edit_club] == 1) && (!$errmsg) && ($row[confirm_entry] == 1)){ ?>
<h1>Thank you</h1>
<? }
if(($confirm != 1) && ($row[triclub_confirm_entry] != 1) && $_GET[confirmed] != "yes"){ ?>
<p>To edit a club, simply change the data you wish. If you make a mistake, just hit the reset button. <font color="red">To save the changes as a NEW club (for instance, if you have multiple chapters), hit the "SAVE AS A NEW CLUB" button. To save changes to the existing club entry, hit the "SAVE CHANGES TO YOUR CLUB" button. You will have a chance to review the data before confirming.</font> <!--Pictures are optional, and you can upload a maximum of 3 photos. The maximum file size for each picture is 600k.--></p>
<? } ?>
<? include("../runshops/include_region_list.php"); ?>
<? if( $_GET[confirmed] != "yes" && (($row[edit_club] != 1) || ($errmsg) || (($confirm != 1) && ($row[triclub_confirm_entry] != 1))) ) { ?>
<form enctype="multipart/form-data" action="wiki_edit.php" method="post">
<p class="cont"><font color="red"><? echo $errmsg; ?></font></p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Store Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_name" value="<? echo stripslashes($row[triclub_name]); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_address" value="<? echo stripslashes(htmlspecialchars($row[triclub_address])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Address 2</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_address_two" value="<? echo stripslashes(htmlspecialchars($row[triclub_address_two])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_city" value="<? echo stripslashes(htmlspecialchars($row[triclub_city])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select name="triclub_state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value) {
if(strcmp($row[triclub_state], $value) == 0){
$str = " selected=\"selected\"";
}
echo "<option value=\"$value\"$str>$value</option>";
$str = "";
}
?>
</select>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_zip" value="<? echo stripslashes(htmlspecialchars($row[triclub_zip])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_email" value="<? echo stripslashes(htmlspecialchars($row[triclub_email])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="triclub_website" value="<? echo stripslashes(htmlspecialchars($row[triclub_website])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" MEMBERSHIP ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">President</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_president])); ?>" type="text" name="triclub_president" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Board Members(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="triclub_board" value="0" <? if ($row[triclub_board] == 0){ echo 'checked'; } ?>>None
<input type="radio" name="triclub_board" value="1" <? if ($row[triclub_board] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[triclub_board_names]); ?>" type="text" name="triclub_board_names" class="txt midtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Total Membership</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_membership])); ?>" type="text" name="triclub_membership" class="txt smltext" /> (number of members only)
</div>
</div>
<div class="drow">
<div class="dcell name">Dues</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_dues])); ?>" type="text" name="triclub_dues" class="txt smltext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 63; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Club Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_info" class="txt lngtext" placeholder="Please write some information about your club."><? if($row[triclub_info]){ echo strip_tags(stripslashes($row[triclub_info])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Sponsors</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_sponsors" class="txt lngtext" placeholder="Please write some information about your club sponsors."><? if($row[triclub_sponsors]) { echo strip_tags(stripslashes($row[triclub_sponsors])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Discounts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_discounts" class="txt lngtext" placeholder="Please write some information about any discounts offered to club members."><? if($row[triclub_discounts]){ echo strip_tags(stripslashes($row[triclub_discounts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions to Workouts &amp; Meeting Location(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_directions" class="txt lngtext" placeholder="Please describe how to get to your club's meetings and workouts from your surrounding area."><? if($row[triclub_directions]){ echo strip_tags(stripslashes($row[triclub_directions])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Workout</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_workouts" class="txt lngtext" placeholder="Please list the schedule of your organized group workouts."><? if($row[triclub_workouts]){ echo strip_tags(stripslashes($row[triclub_workouts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Meetings</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_meetings" class="txt lngtext" placeholder="Please list the schedule of any organized club meetings."><? if($row[triclub_meetings]){ echo strip_tags(stripslashes($row[triclub_meetings])); } ?></textarea>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="submit" name="save_changes" value="Save Your Club Info" class="btn" />
<input type="submit" name="new_club" value="Save As A New Club" class="btn" />
<input type="reset" value="Reset" class="btn" />
<input type="hidden" name="edit_club" value="1" />
<input type="hidden" name="triclub_id" value="<? echo($row[triclub_id]); ?>" />
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="triclub_valid" value="1" />
<input type="hidden" name="triclub_submitted_by" value="<? echo($row[triclub_submitted_by]); ?>" />
<input type="hidden" name="edited_by" value="<? echo($useruid); ?>" />
</div>
</div>
</div>
</form>
<?
} else {
if ($confirm == 1){
$confirm = 0;
include("include_edit_confirm.php");
}
} ?>
</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>