<?php
include ('logue.php'); 
include ('entete2.php');
include ('ressource.php');
include ('entete.php');
echo"
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
input {
border:1px 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>";
echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonie.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"" . $PHP_SELF . "\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 

$sql2 = "SELECT ally,statut FROM matgraph_users WHERE id='$idlogin'";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2);

$sql = "SELECT statut_fondateur 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);

$sql_options = "SELECT admin FROM matgraph_ally_statut WHERE id='$row2[statut]'";
$res_options = db_mysql_Query($sql_options)or die('erreur sql<br>'.$sql_options.'<br>'.mysql_error());
$row_options = mysql_fetch_array($res_options); 


if($row2[ally] == "no") {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
	exit;
}
if(isset($_GET['pers']) && $_GET['pers']=='fondateur'){
echo "<form action=\"ally_statut_edit_envoi.php\" method=\"post\" name=\"form1\" target=\"_parent\">
	  <input type=\"hidden\" name=\"id\" value=\"fondateur\">
	  <table width=\"618\"  border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
	    <tr>
	      <td>Nom de Statut pour le Fondateur :</td>
	      <td><input name=\"statut\" type=\"text\" value=\"".$row['statut_fondateur']."\"></td>
		 </tr>
		 <tr>
		 	<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Valider\"/></td>
	    </table>
	</form>";
}elseif($row2[statut] !== "0" AND $row_options[admin] == "1" OR $row2[statut] == "-1") {

	$id = $_POST["id"];

	if($id == "") {
		echo '<script language="javascript" type="text/javascript">
		<!--
		window.location.replace("ally_droit.php");
		-->
		</script>';
		exit;
	}


	$req = "SELECT * FROM matgraph_ally_statut WHERE id=$id and idally='$row2[ally]'";
	$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
	$row = mysql_fetch_array($res); 

	echo"<form action=\"ally_statut_edit_envoi.php\" method=\"post\" name=\"form1\" target=\"_parent\">
	  <input type=\"hidden\" name=\"id\" value=\"$id\">
	  <table width=\"618\"  border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
	    <tr>
	      <td>Nom</td>
	      <td>G&eacute;rer recrutement</td>
	      <td>Voir liste membres</td>
	      <td>Administrer texte </td>
	      <td>Voir online </td>
	      <td>Mail collectif </td>
	      <td>Admin</td>
	    </tr>
	    <tr>
	      <td><input name=\"nom\" type=\"text\" id=\"nom\" value=\"$row[nom]\"></td>
	      <td><select name=\"recrutement\" id=\"recrutement\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[recrutement] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
	      <td><select name=\"listemembres\" id=\"listemembres\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[listemembres] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
	      <td><select name=\"administrer\" id=\"administrer\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[administrer] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
	      <td><select name=\"online\" id=\"online\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[online] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
	      <td><select name=\"mailcollectif\" id=\"mailcollectif\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[mailcollectif] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
	      <td><select name=\"admin\" id=\"admin\">
	        <option value=\"1\">Oui</option>
	        <option value=\"0\"";if($row[admin] == "0") { echo" selected"; } echo">Non</option>
	      </select></td>
		  </tr>
		  <tr>
		  <td colspan=\"7\" align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"Modifier\"></td>
		  </tr>
	    </table>
	</form>";
}
else {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
	exit;
}
?>
