<?php 

include_once ("_dirinfo.php");
include_once (PATH_TO_ROOT."init.php");

$data = explode("\n",$_POST['import_value']);
foreach ($data as $val) {
	$tmp = explode("\t",$val);
	if (is_numeric($tmp[0])) {
		$sql = "UPDATE ".DB_WARPIT_WEBCATI_BASE."._wwwPoints 
					SET 
						webPoints = ".$tmp[1]." 
					WHERE 
							id_project = ".$_POST['project_id']." 
						AND pointType = 2 
						AND id_user = ".$tmp[0];
		
		$db->SQLexecute($sql);
		if ($db->affectedRows() == 0) {
			$sql = "INSERT INTO ".DB_WARPIT_WEBCATI_BASE."._wwwPoints 
							SET 
									webPoints = ".$tmp[1].", 
									id_project = ".$_POST['project_id'].", 
									pointType = 2, 
									id_user = ".$tmp[0].",
									dateUsed = NOW()";
			$db->SQLexecute($sql);
		}
	}
//echo $sql."\n";
}

echo '{success:true"}';	

?>