<?php
require_once '../../library/config.php';
require_once '../library/functions.php';
require_once '../library/logged.php';
require_once '../../library/validation.php';


if ($_GET['sortList']){
	$table = txt_only($_GET['sortList']);
	$r_name = txt_only($_GET['rank_name']);
	$id = txt_only($_GET['id_name']);
	
	if ( $table == 'subcate'){
		$item_name = $_GET['listSubItem'];
	} else {
		$item_name = $_GET['listItem'];
	}
	
	foreach ($item_name as $position => $item) :
		mysql_query("UPDATE `".$table."` SET `".$r_name."` = ".$position." WHERE `".$id."` = ".$item ,$connePaper);

	endforeach;
}
//echo '<b style="color:red;">Update success! Please refresh the browser</b>';
	
//print_r ($sql);

?>
<b style="color:red;" id="this_info">更新成功!!</b>
<script type="text/javascript">
	setTimeout(function(){$('#this_info').fadeOut(500)}, 2000);
</script>
