<?
include ('logue.php');
include ('config.php');
include ('entete2.php');

$id = htmlentities ($_POST["id"]);
$nom = htmlentities ($_POST["nom"]);
$description = htmlentities ($_POST["description"]);
$img = htmlentities ($_POST["img"]);

if(empty($nom) || empty($description) || empty($img))
{
	echo '<script language=javascript> alert ("Le nom et la description sont obligatoire");</script>';
	
	$include= 'oui';
	include('chantier_changename.php');

	exit;
}

$sql_info = "SELECT iduser,nom,img,description FROM matgraph_vaisseaux WHERE id='".intval($id)."' ";
$res_info = db_mysql_Query($sql_info)or die('erreur sql<br>'.$sql_info.'<br>'.mysql_error());
$row_info = mysql_fetch_array($res_info);

if($row_info[iduser] == $idlogin)
{
	$sql = "UPDATE matgraph_vaisseaux SET nom='".addslashes($nom)."',description='".addslashes($description)."',img='".addslashes($img)."' WHERE id='$id' ";
	$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
}


echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("chantier.php");
-->
</script>';


?>