Пример #1
0
    exit('403');
}
/** gọi tệp tin admin base */
require_once dirname(__FILE__) . '/admin.php';
/** gọi model xử lý menu */
require_once dirname(__FILE__) . '/menu/menu_model.php';
$key = hm_get('key');
$id = hm_get('id');
$action = hm_get('action');
switch ($action) {
    case 'add':
        echo add_menu();
        break;
    case 'edit':
        echo edit_menu($id);
        break;
    case 'delete':
        $menu_id = hm_post('id');
        echo delete_menu($menu_id);
        break;
    case 'delete_item':
        $item_id = hm_post('id');
        echo delete_menu_item($item_id);
        break;
    case 'edit_item':
        echo edit_menu_item($id);
        break;
    case 'save_order':
        echo save_menu_item_order($id);
        break;
    case 'location':
    $dbc = mysql_connect('localhost', 'root', 'rishi');
    if (!$dbc) {
        die('NOT CONNECTED:' . mysql_error());
    }
    $db_selected = mysql_select_db("restaurant", $dbc);
    if (!$db_selected) {
        die('NOT CONNECTED TO DATABASE:' . mysql_error());
    }
    if (empty($menu_id)) {
        echo "<script type=\"text/javascript\">" . "\n";
        echo "alert(\"No Items Selected!!!\");" . "\n";
        echo "</script>" . "\n";
        echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.html\">" . "\n";
    } else {
        $num_users = count($menu_id);
        for ($i = 0; $i < $num_users; $i++) {
            $query = "DELETE FROM MENU WHERE Menu_Id = {$menu_id[$i]};";
            mysql_query($query);
        }
        echo "<script type=\"text/javascript\">" . "\n";
        echo "alert(\"Selected Items Deleted!!!\");" . "\n";
        echo "</script>" . "\n";
        echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.html\">" . "\n";
    }
}
delete_menu($_POST["menu"]);
?>
</html>
</body>
</html>