init(); // sets styling for post events forms $cat = "events"; echo("\n\n"); include "$webdir/includes/internal-header.html"; // get configs (needed for banners) include "$webdir/include/config.php"; include "$webdir/include/database.php"; $WebSite = $CurrentWebsite; // set up banners include "$webdir/include/get-website.php"; include "$webdir/include/display-banners.php"; $number_of_side_banners = 5; $category_loc_num = 11; if (!$stage) include "event_form.html"; if ($stage == "one") { // Ensure required fields are entered if (!$name || !$phone || !$email || !$title || !$location || !$date_time) { $error_msg = "Required Information is Missing"; include "event_form.html"; include "$webdir/includes/internal-footer.html"; exit; } // Validate the event text if (!$event_text) { $error_msg = "Event Description is Missing"; include "event_form.html"; include "$webdir/includes/internal-footer.html"; exit; } if (strlen($event_text) > 1000) { $error_msg = "Event Description is Too Long"; include "event_form.html"; include "$webdir/includes/internal-footer.html"; exit; } // Validate the start and end dates $start_date = "$year_start-$month_start-$day_start"; $end_date = "$year_end-$month_end-$day_end"; if ($end_date < $start_date) { $end_date = $start_date; $year_end = $year_start; $month_end = $month_start; $day_end = $day_start; } include "event_preview.php"; } if ($stage == "two") { // Setup defaults for insertion into DB $website = $CurrentWebsite; $display = 'N'; $added_date = date("Y-m-d",time()); // Fields that require cleanup $field_names = array('name', 'title', 'date_time', 'location', 'information', 'event_text'); // perform cleanups foreach ($field_names as $fldName) { $value = ${$fldName}; // convert whitespace chars to
tags $value = eregi_replace("\r", "", $value); $value = eregi_replace("\n", "
", $value); // replace extra large
spacing gaps $valueTemp = eregi_replace('


', '

', $value); while ($valueTemp != $value) { $value = $valueTemp; $valueTemp = eregi_replace('


', '

', $value); } // replace starting
tags $valueTemp = eregi_replace('^
', '', $value); while ($valueTemp != $value) { $value = $valueTemp; $valueTemp = eregi_replace('^
', '', $value); } // replace ending
tags $valueTemp = eregi_replace('
$', '', $value); while ($valueTemp != $value) { $value = $valueTemp; $valueTemp = eregi_replace('
$', '', $value); } // replace strange chars $value = ereg_replace("’","'",$value); $value = ereg_replace("‘","'",$value); $value = ereg_replace("–","-",$value); $value = ereg_replace("“",'"',$value); $value = ereg_replace("”",'"',$value); $value = ereg_replace("€",'"',$value); $value = ereg_replace('โ"œ','"',$value); $value = ereg_replace('โ"','"',$value); $value = ereg_replace("…",'...',$value); $value = ereg_replace("•",';',$value); $value = ereg_replace("กฏ","'",$value); $value = ereg_replace("โ€™","'",$value); $value = ereg_replace('โ"™',"'",$value); $value = ereg_replace('"','"',$value); $value = ereg_replace("ฟ",'¿',$value); $value = ereg_replace("ก",'¡',$value); $value = ereg_replace('&',"&",strip_tags(stripslashes($value))); $value = ereg_replace('ฉ',"©",strip_tags(stripslashes($value))); $value = ereg_replace('™',"™",strip_tags(stripslashes($value))); $value = ereg_replace('ฎ',"®",strip_tags(stripslashes($value))); $value = ereg_replace('ข',"¢",strip_tags(stripslashes($value))); $value = ereg_replace('€',"€",strip_tags(stripslashes($value))); $value = ereg_replace('ฃ',"£",strip_tags(stripslashes($value))); $value = ereg_replace('ฅ',"¥",strip_tags(stripslashes($value))); $value = ereg_replace('ฑ',"±",strip_tags(stripslashes($value))); $value = ereg_replace('–',"–",strip_tags(stripslashes($value))); $value = ereg_replace('—',"—",strip_tags(stripslashes($value))); // format for saving in DB $value = mysql_escape_string($value); // replace old content with new cleaned up version ${$fldName} = $value; } $table_name = "events"; include "$phpdir/insert_table.php"; include "event_thanks.html"; } $cat = "postevents"; // prevents display of homepage textlinks include "$webdir/includes/internal-footer.html"; ?>