<?php
session_start();

include('includes/ajax_check_login.php');

if( !isset($_REQUEST['message_id']) || ( $static_uint_message_id = (int)$_REQUEST['message_id'] ) <= 0 )
	exit(json_encode(array('ErrCode'=>-1, 'ErrMessage'=>'輸入資料不足', 'RedirectURL'=>'')));

require_once('includes/common.php');

require_once('includes/admin.php');
$obj_class_admin = new class_admin();

if( !( $arr_message = $obj_class_admin->get_contact_us_by_message_id($static_uint_message_id) ) )
	exit(json_encode(array('ErrCode'=>0, 'ErrMessage'=>'所選擇的留言紀錄不存在！', 'RedirectURL'=>'')));
else if( !$obj_class_admin->delete_contact_us($static_uint_message_id) )
	exit(json_encode(array('ErrCode'=>0, 'ErrMessage'=>'留言紀錄刪除失敗！', 'RedirectURL'=>'')));
else
	exit(json_encode(array('ErrCode'=>1, 'ErrMessage'=>'留言紀錄刪除成功', 'RedirectURL'=>'')));
?>