<?php 
include_once('config.php');
$sys = new System();

$rtn 		= array();
$adID 		= array();
$condition 	= array();
$adID 		= $sys -> getDataPost('sequence');
$loc 		= $sys -> getDataPost('location');
$lang 		= $sys -> getDataPost('language');
$cnt 		= 1;
$ids 		= array();
foreach ($adID as $value) {
	$condition[] = '(\')'.$value .'(\')'.' THEN ' . '(\')'.$cnt.'(\')';
	$ids[] 		 = '(\')'.$value.'(\')';
	$cnt++;
}

$rtn[] = implode(' WHEN ', $condition);
$rtn[] = implode(', ', $ids);

$sys -> accessModifyCommon('UPDATE_AD_SEQUENCE', $rtn);
$sys -> accessModify('INSERT_ACTIVITY', array($sys -> getAdminUserData(PARAM_UID), $_SERVER[PARAM_REMOTE_ADDR], $_SERVER[PARAM_HTTP_USER_AGENT], 26, date("Y-m-d H:i:s"), 'Edited the sequence of images in ('.$loc.' '.$lang.')'), false);


?>