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

$id = $_POST["id"];
$type = $_POST["type"];

echo"
<BODY TEXT=\"#ffffff\">
<BODY LINK=\"#ffffff\">
<BODY VLINK=\"#ffffff\">
<BODY ALINK=\"#ffffff\">
<body bgcolor=\"#000000\">
<style>
input {
border:0px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
textarea {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
select, option {
background-color:#000000;
color:white;
}
</style>
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
</STYLE>";

// La variable de condition
$liste_id = "(0";

$reqtmpid = "SELECT id FROM matgraph_users WHERE idjoueur = '$idlogin'";
$restmpid = mysql_query($reqtmpid) or die('Erreur SQL! <br>'.$reqtmpid.'<br>'.mysql_error());
while( $rowtmpid = mysql_fetch_array($restmpid) ) {
	$liste_id = $liste_id." OR receveur = $rowtmpid[id]";
}
$liste_id = $liste_id.")";

if($type == "combat") {
$req = "SELECT * FROM matgraph_bataille WHERE $liste_id AND id='$id' ORDER BY id DESC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
$lire = "lire" ;
  $liree = $id.$row[id];
echo"<div align=\"center\"><br><table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td width=\"587\"><div align=\"center\"><font color=\"";
	if($row[win] == "1") { echo"00CC00";} else {echo"FF0000";} echo"\">$row[sujet]</font> Du $row[date]</div></td>
      </tr>
  <tr>
    <td><div align=\"left\">";
echo ' <br> ' . html_entity_decode ($row[message], ENT_QUOTES) . '</FONT>' ; echo"</div></td>
</tr>
<tr>
<form name=\"$liree\" id=\"$liree\" method=\"post\" action=\"mp_lire_combat_detail.php\" target=\"_blank\" width=\"618\">
	<input type=\"hidden\" name=\"id\" value=\"$row[id]\">
	<input type=\"hidden\" name=\"type\" value=\"combat\">
	<td width=\"311\" align=\"center\"><a href=\"#\" target=\"_parent\" Onclick=\"document.getElementById('$liree').submit()\">Detail</a>
	</td>
	</form>
  </tr>";
echo"<form> <tr>
  <td height=\"50\" colspan=\"2\" align=\"center\" valign=\"middle\">
  <input type=\"button\" value=\"Fermer\" onclick=\"window.close()\" Style=\"border:1px solid #7E7E7E;\"></td>
  </tr></form>
</table>"; }
if($type == "msgally") {
$req = "SELECT * FROM matgraph_msgally WHERE $liste_id AND id='$id' ORDER BY id DESC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
echo"<div align=\"center\"><br><table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td width=\"587\"><div align=\"center\"> ".htmlentities($row[sujet])." Du $row[date]</div></td>
      </tr>
  <tr>
    <td><div align=\"center\">".htmlentities($row[msg])."</div></td>
  </tr>";
echo"<form> <tr>
  <td height=\"50\" colspan=\"2\" align=\"center\" valign=\"middle\">
  <input type=\"button\" value=\"Fermer\" onclick=\"window.close()\" Style=\"border:1px solid #7E7E7E;\"></td>
  </tr></form>
</table>"; }
if($type == "msg") {
$req = "SELECT * FROM matgraph_msg WHERE $liste_id AND id='$id' ORDER BY id DESC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
echo"<div align=\"center\"><br><table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td width=\"587\"><div align=\"center\"> $row[sujet] Du $row[date]</div></td>
      </tr>
  <tr>
    <td><div align=\"center\">$row[msg]</div></td>
  </tr>";
echo"<form> <tr>
  <td height=\"50\" colspan=\"2\" align=\"center\" valign=\"middle\">
  <input type=\"button\" value=\"Fermer\" onclick=\"window.close()\" Style=\"border:1px solid #7E7E7E;\"></td>
  </tr></form>
</table>"; }
if($type == "espio") {
$req = "SELECT * FROM matgraph_espio1 WHERE $liste_id AND id='$id' ORDER BY id DESC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
echo"<br><table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
  <tr>
    <td width=\"587\"><div align=\"center\"><font color=\"9966CC\">$row[sujet]</font>  Du $row[date]</div></td>
    <form name=\"suprimer\" method=\"post\" action=\"mp_del2.php\" target=\"_parent\"><td width=\"25\" colspan=\"-1\" align=\"right\">
           <input type=\"hidden\" name=\"id\" value=\"$row[id]\">
          <input type=\"image\" src=\"imgs/del.gif\" width=\"25\">
                  </td></form>
  </tr>
  <tr>
    <td colspan=\"2\"><div align=\"center\">$row[message]</div></td>
  </tr>";

echo"<form> <tr>
  <td height=\"50\" colspan=\"2\" align=\"center\" valign=\"middle\">
  <input type=\"button\" value=\"Fermer\" onclick=\"window.close()\" Style=\"border:1px solid #7E7E7E;\"></td>
  </tr></form>
</table>"; }
if($type == "contreespio") {
$req = "SELECT * FROM matgraph_contreespio WHERE $liste_id AND id='$id' ORDER BY id DESC";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
echo"<div align=\"center\"><br><table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td width=\"587\"><div align=\"center\">$row[sujet]  Du $row[date]</div></td>
    <form name=\"suprimer\" method=\"post\" action=\"mp_del3.php\" target=\"_parent\"><td width=\"25\" colspan=\"-1\" align=\"right\">
           <input type=\"hidden\" name=\"id\" value=\"$row[id]\">
          <input type=\"image\" src=\"imgs/del.gif\" width=\"25\">
                  </td></form>
  </tr>
  <tr>
    <td colspan=\"2\"><div align=\"center\">$row[message]</div></td>
  </tr>";
echo"<form> <tr>
  <td height=\"50\" colspan=\"2\" align=\"center\" valign=\"middle\">
  <input type=\"button\" value=\"Fermer\" onclick=\"window.close()\" Style=\"border:1px solid #7E7E7E;\"></td>
  </tr></form>
</table>"; }
?>
