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

echo"
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<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>";


$id = $_POST["id"];

$row2[ally] = $id ;

$reponse  = db_mysql_Query("SELECT pts_ally FROM matgraph_ally WHERE id='$row2[ally]'");
$reponse2 = db_mysql_Query("SELECT COUNT(id) FROM matgraph_ally WHERE pts_ally > ".mysql_result($reponse,0));
$classement = mysql_result($reponse2,0)+1;

$reqtotal = "SELECT * FROM matgraph_ally";
$restotal = db_mysql_Query($reqtotal) or die('Erreur SQL! <br>'.$reqtotal.'<br>'.mysql_error());
$numtotal = mysql_num_rows($restotal);

$sql = "SELECT * FROM matgraph_ally WHERE id='$row2[ally]'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res); 

$req = "SELECT id FROM matgraph_users WHERE ally='$row[id]' ORDER by id ASC";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);

$present = htmlentities (stripslashes($row[presentation]));

$bbcode= array (
"/\[b\](.+?)\[\/b\]/si",
"/\[i\](.+?)\[\/i\]/si",
"/\[u\](.+?)\[\/u\]/si",
"/\[url=(.+?)\](.+?)\[\/url\]/si",
"/\[img\](.+?)\[\/img\]/si",

);
$htmlcode= array (
"<b>$1</b>",
"<i>$1</i>",
"<u>$1</u>",
"<a href='$1'>$2</a>",
"<img src='$1'>"
);
$present=preg_replace($bbcode,$htmlcode,$present);

$present=preg_replace('!\[color=(.+)\](.+)\[/color\]!isU', "<span style='color:$1'>$2</span>", $present); //couleur
$present=preg_replace('!\[align=(left|center|right)\](.+)\[/align\]!isU', "<div align='$1'>$2</div>", $present); //aligner

$present=nl2br($present);

echo"<div align=\"center\"><table width=\"618\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"#000000\" style=\"font-family:trebuchet ms,sans-serif; font-size: 9pt ;\">";
if(!empty($row[img])) { echo"
  <tr>
    <td colspan=\"2\"><div align=\"center\"><img src=\"$row[img]\"></div></td>
  </tr>";} echo"
  <tr style =\"background-color:#222222;\">
    <td width=\"119\"><strong>Nom : </strong></td>
    <td width=\"493\" align=\"center\">$row[nom]</td>
  </tr>
  <tr>
    <td><strong>Tag : </strong></td>
    <td align=\"center\">$row[tag]</td>
  </tr>
  <tr style =\"background-color:#222222;\">
    <td><strong>Classement : </strong></td>
    <td align=\"center\">$classement / $numtotal</td>
  </tr>
  <tr>
    <td><strong>Membres : </strong></td>
    <td align=\"center\">$num</td>
  </tr>
  <tr style =\"background-color:#222222;\">
    <td height=\"39\" colspan=\"2\"><strong>Pr&eacute;sentation : </strong></td>
  </tr>
  <tr>
    <td colspan=\"2\">$present</td>
  </tr>
  <tr style =\"background-color:#222222;\">
    <td><strong>Page d'accueil :
    </strong></td>
    <td align=\"center\"><a href=\"$row[url]\" target=\"_blank\">$row[url]</a></td>
  </tr>
  </table>";
  
echo"<br><br><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>";
?>
