Old stuff/old_sites/epik/include/team.php
(Deskargatu)
<div class="article">
<h2>Team #informatique</h2>
<?
if($axx>8 && $chemin[2] == "modif")
{
if ($_POST['action'] == "modifier" && !empty($chemin[3]) && !empty($_POST['pseudo']) && !empty($_POST['categorie']))
{
$pseudo = $_POST['pseudo'];
$fonction = $_POST['fonction'];
$categorie = $_POST['categorie'];
echo "<div class=\"element\"><h2>UPDATE de la table team</h2>";
$query = "UPDATE staff SET pseudo='$pseudo',fonction='$fonction',categorie='$categorie' WHERE id='$chemin[3]'";
mysql_query($query) or die("ERREUR: ".mysql_error());
echo "<div><p class=\"underline\">Table modifiée avec succès</p>
<p>USER: $pseudo</p>
<p>Fonction: $fonction</p>
<p>Categorie: $categorie</p>
</div></div>";
}
elseif($_POST['action'] == "supprimer" && !empty($chemin[3]))
{
echo "<div class=\"element\"><h2>Suppression d'un element</h2>";
$query = "DELETE FROM staff WHERE id='$chemin[3]' LIMIT 1";
mysql_query($query) or die("ERREUR: ".mysql_error());
echo "<div><p>Suppression effectuée avec succè</p></div></div>";
}
else {
echo "<div class=\"element\"><h2>Modification de la team</h2><div><ul>";
$result = mysql_query("SELECT * from staff ORDER BY pseudo ASC") or die("ERREUR: ".mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "
<form action=\"/site/team/modif/$row[0]\" method=\"post\">
<li>
<input name=\"pseudo\" type=\"text\" value=\"$row[1]\" />
<input name=\"fonction\" type=\"text\" value=\"$row[2]\" />
<select name=\"categorie\">";
echo "<option value=\"Admin\"";
if ($row[3] == "Admin") { echo " selected=\"selected\" "; }
echo ">Admin</option>";
echo "<option value=\"team\"";
if ($row[3] == "team") { echo " selected=\"selected\" "; }
echo ">Team</option>";
echo "<option value=\"dev\"";
if ($row[3] == "dev") { echo " selected=\"selected\" "; }
echo ">Développement</option>\n
</select>
";
echo "
<input name=\"action\" class=\"button\" type=\"submit\" value=\"modifier\" />
<input name=\"action\" class=\"button\" type=\"submit\" value=\"Supprimer\" />
</li>
</form>
";
}
echo "</ul><p><a href=\"/site/team/new\" title=\"Ajouter un element\">Nouvel élément</a></p></div></div>
";
}
}
elseif($axx>8 && $chemin[2] == "new")
{
if (!empty($_POST['pseudo']) && !empty($_POST['categorie']))
{
$pseudo = $_POST['pseudo'];
$fonction = $_POST['fonction'];
$categorie = $_POST['categorie'];
echo "<div class=\"element\"><h2>UPDATE de la table team</h2>";
$query = "INSERT INTO staff (pseudo,fonction,categorie) VALUES('$pseudo','$fonction','$categorie');";
mysql_query($query) or die("ERREUR: ".mysql_error());
echo "<div><p>Nouveau membre ajouté</p>
<p><a href=\"/site/team/new\">Ajouter un autre membre</a></p>
<p><a href=\"/site/team/modif\">modifier l'equipe</a></p>
<p><a href=\"/site/\">index</a></p>
</div></div>";
}
else {
echo "<div class=\"element\"><h2>Ajout d'un element</h2><div>";
echo "
<form action=\"/site/team/new/\" method=\"post\">
<p>
<input name=\"pseudo\" type=\"text\" value=\"pseudo\" />
<input name=\"fonction\" type=\"text\" value=\"fonction\" />
<select name=\"categorie\"
<option value=\"Admin\">admin</option>
<option value=\"dev\">dev</option>
<option value=\"team\">team</option>
</select>
<input class=\"button\" type=\"submit\" value=\"Ajouter\" />
</p>
</form> ";
}
echo "</div></div>";
}
else
{
?>
<div class="element">
<h2>Les administrateurs</h2>
<div>
<dl>
<?
$query = "SELECT * from staff WHERE categorie='admin' ORDER BY fonction ASC";
$result = mysql_query($query) or die("FATAL: ".mysql_error()."<br>$query");
while ($row = mysql_fetch_array($result))
{
echo "<dt><a href=\"http://www.epiknet.org/club/fiche.asp?nick=$row[1]\" title=\"Fiche epiknet\">$row[1]</a>\n</dt><dd>$row[2]</dd>\n";
}
?>
</dl>
</div>
</div>
<div class="element">
<h2>Les développeurs</h2>
<div>
<dl>
<?
$query = "SELECT * from staff WHERE categorie='dev' ORDER BY fonction ASC";
$result = mysql_query($query) or die("FATAL: ".mysql_error()."<br>$query");
while ($row = mysql_fetch_array($result))
{
echo "<dt><a href=\"http://www.epiknet.org/club/fiche.asp?nick=$row[1]\" title=\"Fiche epiknet\">$row[1]</a>\n</dt><dd>$row[2]</dd>\n";
}
?>
</dl>
</div>
</div>
<div class="element">
<h2>Les membres de l'équipe</h2>
<div>
<dl>
<?
$query = "SELECT * from staff WHERE categorie='team' ORDER BY fonction ASC";
$result = mysql_query($query) or die("FATAL: ".mysql_error()."<br>$query");
while ($row = mysql_fetch_array($result))
{
echo "<dt><a href=\"http://www.epiknet.org/club/fiche.asp?nick=$row[1]\" title=\"Fiche epiknet\">$row[1]</a>\n</dt><dd>$row[2]</dd>\n";
}
?>
</dl>
</div>
</div>
<?
}
?>
</div>