<?
ob_start();
session_start();
require_once("../../config.php");

$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
$b=explode(",",str_replace(" ","",$_GET['boxes']));
$i=1;
foreach($b as $box)
{
	if(strlen($box)>=1 && $box!="" && $box!=" ")$boxy[]=$box;
}
for($i=1;$i<=count($boxy);$i++)
{
	$z="update ecmdocuments set no='".$i."' where id='".$boxy[$i-1]."' and iddir='".$_REQUEST['record']."'";
	if(mysql_query($z))$ok=1;
	else $error="Error";
}
if($error)print $error;
else print "Saved";
?>
