<?php
include("../../include/session.php");
if(!$session->isAdmin()){
	header("Location: ../../main.php");
}else{
	include("../../include/db.php");
	$orderNo = mysql_real_escape_string($_GET['orderNo']);
	$q = "SELECT canceled FROM nam_orders WHERE orderNo = '$orderNo'";
	$r = execsql($q);
	if(mysql_result($r, 0, "canceled") == 0){
		$q = "UPDATE nam_orders SET canceled = 1 WHERE orderNo = '$orderNo'";
		execsql($q);
//		echo $q;

				header("Location: ../orderByDates.php?orderNo=$orderNo");
	}else{
		$q = "UPDATE nam_orders SET canceled = 0 WHERE orderNo = '$orderNo'";
		execsql($q);
//		echo $q;
				header("Location: ../orderByDates.php?orderNo=$orderNo");
	}
//	echo $q;


}