<?PHP

include("config.php");

if(!is_admin($user)){
  header('Location:'.$site_url.'/');
}

if (!$_POST){ header('Location: '.$site_url); }

if ($_POST[action] == "archive") {
	$sql = "UPDATE io_campaign SET campaign_archive = 1, campaign_archive_timestamp = '".date('Y-m-d')."' WHERE campaign_id = '$_POST[campaign_id]'";
} elseif ($_POST[action] == "screenshot") {
	$sql = "UPDATE io_campaign SET campaign_screenshot_timestamp = '".date('Y-m-d')."' WHERE campaign_id = '$_POST[campaign_id]'";
} elseif ($_POST[action] == "invoice") {
	$sql = "UPDATE io_campaign SET campaign_invoice_timestamp = '".date('Y-m-d')."' WHERE campaign_id = '$_POST[campaign_id]'";
} elseif ($_POST[action] == "deploy") {
	$sql = "UPDATE io_campaign SET campaign_deploy_timestamp = '".date('Y-m-d')."' WHERE campaign_id = '$_POST[campaign_id]'";
} elseif ($_POST[action] == "unarchive") {
	$sql = "UPDATE io_campaign SET campaign_archive = 0, campaign_archive_timestamp = '0' WHERE campaign_id = '$_POST[campaign_id]'";
}

//echo $sql;
//exit();
mysql_query($sql) or die(mysql_error());

header('Location: campaign_detail.php?campaign_id='.$_POST[campaign_id]);

?>