<?php
session_start();
if (!isset($_SESSION['FirstName'])) {
	exit;
}

include ('includes/db1config.php');
include ('../includes/mysql_connect.php');

if (isset($_POST) && !empty($_POST)) {
	if (isset($_POST['menu_items_order']) && !empty($_POST['menu_items_order'])) {
		$i = 1;
		foreach ($_POST['menu_items_order'] as $menuItemId) {
			$sql = "UPDATE menuItem
					SET orderNum = '".$i."'
					WHERE itemKey = '".mysql_real_escape_string($menuItemId)."'";
			mysql_query($sql) or die(mysql_error());
			$i++;
		}
		die('1');
	}
}

die('0');
?>