<?php
session_start();

include('includes/ajax_check_login.php');

require_once('includes/common.php');

if( !isset($_POST) )
	exit(json_encode(array('ErrCode'=>-1, 'ErrMessage'=>'輸入資料不足', 'RedirectURL'=>'')));

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

$arr_macthes = array();
foreach( $_POST as $str_key=>$str_value )
{
	if( preg_match('/^picture_subject_(\d+)$/i', $str_key, $arr_matches) )
	{
		if( !$obj_class_admin->update_news_picture_subject((int)$arr_matches[1], $str_value) )
			exit(json_encode(array('ErrCode'=>0, 'ErrMessage'=>'更新圖片標題失敗！', 'RedirectURL'=>'')));
	}
}

exit(json_encode(array('ErrCode'=>1, 'ErrMessage'=>'更新圖片標題成功', 'RedirectURL'=>'')));
?>