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

$id = $_POST["id"];

$req = "SELECT id FROM matgraph_users WHERE idjoueur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_users WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_vaisseaux WHERE iduser = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_vaisseaux WHERE iduser = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_ally_recrut WHERE idjoueur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_ally_recrut WHERE iduser = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_commerce WHERE joueur1 = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_commerce WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_commerce WHERE joueur2 = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_commerce WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_bataille WHERE receveur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_bataille WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_contreespio WHERE receveur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_contreespio WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_espio1 WHERE receveur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_espio1 WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_espio2 WHERE idjoueur = $id OR idespionner = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_espio2 WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_explorer WHERE receveur = $id OR envoyeur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_explorer WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_idjoueur WHERE idjoueur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_idjoueur WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_mp WHERE receveur = $id OR envoyeur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_mp WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_msg WHERE receveur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_msg WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_msgally WHERE receveur = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_msgally WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}

$req = "SELECT id FROM matgraph_nbrevaisseaux WHERE user = $id ORDER by id ASC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {
  While ( $row = mysql_fetch_array($res) ) {
  
$sql4 = "DELETE FROM matgraph_nbrevaisseaux WHERE id = $row[id]";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());

}}


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