<?
	header("Content-Type: text/html; charset=utf-8");
	
	$la_tmp = explode('/app/', $_SERVER['SCRIPT_FILENAME']);
	
	$l_path_minus = $la_tmp[0].'/app/webroot/iso/';
	$g_path = $la_tmp[0].'/app/webroot/iso/my/';
	
	include $g_path."u_globals.php";
	include $g_path."html/f.php";
	include $g_path."u_spoj_na_bazu.php";
	
	$can_live_alone = 1;
	include $g_path."u_headers.php";
	
	
	$l_person_id = $_SESSION['__id'];
	if(!$l_person_id){
		exit;
	}
	
	if(strlen($_GET['name']) > 50 ){
		$_GET['name'] = substr($_GET['name'], 0, 50);
	}
	
	
	$la_data = array();
	
	//p('select id from products where name = "'.$_GET['name'].'" ');
	
	$l_sql = 'select id from products where name = "'.$_GET['name'].'" ';
	$l_id = get_item($l_sql);
	
	if($l_id > 0){
		$la_data['ok'] = 1;
	}else{
		$la_data['ok'] = 0;
	}
	
	$la_json = json_encode($la_data);
	print $la_json;
	exit;
?>
