<?PHP 

if (!$_POST){ header('Location: https://slowtwitch.com/calendar/'); }

include("config.php");

// error checking
if(!isset($_POST)) exit();

if (isset($_POST[delete])) {	
	// convert the array to a SQL friendly format
	$deleteList = "(".implode(",", $_POST[delete]).")";
	
	// build the SQL query to delete the edits that are bad
	$sql = "DELETE FROM gforum_Triathlons WHERE uid IN $deleteList";
			  
	mysql_query($sql) or die(mysql_error());
}

if (isset($_POST[validate])) {
	// convert the array to a SQL friendly format
	$uidlist = "(".implode(",", $_POST[validate]).")";
	
	// build the SQL query
	$sql = "UPDATE gforum_Triathlons
			  SET valid = 1
			  WHERE uid IN $uidlist;";
			  
	mysql_query($sql) or die(mysql_error());
}

header('Location: https://slowtwitch.com/calendar/validate.php');

?>