1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
| <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="copyright" content="Copyright Robin" />
<title>SadHost</title>
<link href="admin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<?php
extract($_POST);
if (!empty($_POST['if']) && $_POST['if'] == 'if')
{
if(!empty($_POST['nom_offre'])
&& !empty($_POST['disque'])
&& !empty($_POST['Bande_passente'])
&& !empty($_POST['Comptes_courriels'])
&& !empty($_POST['Sous_domaine'])
&& !empty($_POST['Domaine_gares'])
&& !empty($_POST['Domaine_compagnons'])
&& !empty($_POST['Compte_FTP'])
&& !empty($_POST['BDD'])
&& !empty($_POST['prix'])
&& !empty($_POST['Listes_des_destinataires'])
&& !empty($_POST['offre'])
&& isset($_POST['nom_offre'])
&& isset($_POST['disque'])
&& isset($_POST['Bande_passente'])
&& isset($_POST['Comptes_courriels'])
&& isset($_POST['Sous_domaine'])
&& isset($_POST['Domaine_gares'])
&& isset($_POST['Domaine_compagnons'])
&& isset($_POST['Compte_FTP'])
&& isset($_POST['BDD'])
&& isset($_POST['Listes_des_destinataires'])
&& isset($_POST['prix'])
&& isset($_POST['offre']))
{
include('config.php');
$id =mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['id']))));
$nom_offre =mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['nom_offre']))));
$disque = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['disque']))));
$Bande_passante = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Bande_passante']))));
$Comptes_courriels = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Comptes_courriels']))));
$Sous_domaine = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Sous_domaine']))));
$Domaine_gares = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Domaine_gares']))));
$Domaine_compagnons = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Domaine_compagnons']))));
$Compte_FTP = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Compte_FTP']))));
$BDD =mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['BDD']))));
$prix =mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['prix']))));
$Listes_des_destinataires = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['Listes_des_destinataires']))));
$offre = mysql_real_escape_string(strip_tags(htmlspecialchars(trim($_POST['offre']))));
$sql="SELECT nom_offre FROM offres WHERE nom_offre ='$nom_offre'";
$req= mysql_query($sql)or die ('Erreur SQL!' .$sql.'<br/<>'.mysql_error());
$data=mysql_fetch_assoc($req);
if(empty($data)) {
$sql="INSERT INTO offres (nom_offre,disque,Bande_passente,Comptes_courriels,Sous_domaine,Domaine_gares,Domaine_compagnons,Compte_FTP,BDD,Listes_des_destinataires,prix,offre)
VALUES ('$nom_offre','$disque','$Bande_passente','$Comptes_courriels','$Sous_domaine','$Domaine_gares','$Domaine_compagnons','$Compte_FTP','$BDD','$Listes_des_destinataires','$prix','$offre')";
$req= mysql_query($sql)or die ('Erreur SQL!' .$sql.'<br />'.mysql_error());
}
else{
$erreur = "L'offre $nom_offre est déjà prit!";
}
}
else{
$erreur = 'Au moins un des champs est vide.';
}
}
if (isset($erreur)) {
?>
<div class="error">
<?php echo '<br /><br />',$erreur;
}?>
</div>
<body>
<form method="post" action="index.php" enctype="multipart/form-data">
<fieldset>
<legend>Ajout d'une offre</legend>
<label for="espace">Nom de l'offre</label>
<input type="text" id="nom_offre" name="nom_offre"/>
<label for="espace">Espace disque</label>
<input type="text" id="disque" name="disque"/>
<label for="bande">Bande passante</label>
<input type="text" id="Bande_passente" name="Bande_passente"/>
<label for="nom">Comptes courriels</label>
<input type="text" id="Comptes_courriels" name="Comptes_courriels"/>
<label for="espace">Sous-domaines</label>
<input type="text" id="Sous_domaine" name="Sous_domaine"/>
<label for="espace">Domaines garés</label>
<input type="text" id="Domaine_gares" name="Domaine_gares"/>
<label for="espace">Domaines compagnons</label>
<input type="text" id="Domaine_compagnons" name="Domaine_compagnons"/>
<label for="espace">Compte FTP</label>
<input type="text" id="Compte_FTP" name="Compte_FTP"/>
<label for="espace">Base de données</label>
<input type="text" id="BDD" name="BDD"/>
<label for="espace">Prix</label>
<input type="text" id="prix" name="prix"/>
<label for="espace">Listes des destinataires</label>
<input type="text" id="Listes_des_destinataires" name="Listes_des_destinataires"/>
<label for="espace"><br />Catégorie du plan</label>
<input type="radio" name="offre" value="hebergement" checked="checked" /> Hebergement
<input type="radio" name="offre" value="revendeur" /> Revendeur
<input type="hidden" name="if" value="if">
</br><br>
<button type="submit">Ajouter</button>
</fieldset>
</form>
<?php
unset($_POST['offre']);
echo $_POST['offre'];
include('config.php');
$sql="SELECT * FROM offres ";
$req= mysql_query($sql)or die ('Erreur SQL!' .$sql.'<br/<>'.mysql_error());
?>
<table summary="Liste des images de la galerie">
<caption>Liste des offres</caption>
<tr>
<th>Id</th>
<th>Nom</th>
<th>Modifier</th>
<th>Supprimer</th>
</tr>
<?php
$requeteselect = 'SELECT * FROM offres';
$req= mysql_query($sql)or die ('Erreur SQL!' .$sql.'<br/<>'.mysql_error());
while($data=mysql_fetch_assoc($req))
{
?>
<tr>
<td><?php echo $data["id"] ?></td>
<td><?php echo $data["nom_offre"] ?></td>
<td></td>
<td><?php echo "<a href=\"supprimer.php?id={$data["id"]}\"> Supprimer</a>"; ?></td>
</tr>
<?php
}
mysql_close();
?>
</table>
</body> |
Partager