<?
include ("../common/scripts/connect.inc.php");

session_start();

if(isset($_POST['posx']) && isset($_POST['posy']) && isset($_POST['idMimi']))
{
	$posX=$_POST['posx'];
	$posY=$_POST['posy'];
	$id_mimichant=$_POST['idMimi'];
	
	//récupération du nombre de chocopépites de l'utilisateur
	$result= pg_query($dbconn,"select ground_build, ground_id from grounds where ground_pos[0]=".$posX." and ground_pos[1]=".$posY);	
	$terrain=pg_fetch_row($result);
	
	if($terrain[0]==1)
	{
		$_SESSION['idChar'] = $id_mimichant;
		$_SESSION['idTerrain'] = $terrain[1];
		
		echo '1';
	}
	
	

}


?>