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
| <?php
session_start();
?>
<?php
include ('inc/php/doctype.php');
include ('inc/php/connexion.php');
$_POST['time'] = date("j M Y H:i:s ");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
include ('inc/php/head.php');
?>
<body>
<div class="admin">
<h1>Administration générale</h1>
<br />
<br />
<form id="form1" action="insert_ndd.php" method="post" enctype="application/x-www-form-urlencoded">
<fieldset>
<legend>Formulaire d'ajout d'un nom de domaine</legend>
<br />
<label for="nd">Nom de domaine :</label>
<input type="text" name="nd" id="nd" size="40" />
<br />
<label for="pop">Adresse POP :</label>
<input type="text" name="pop" id="pop" size="40" class="calage"/>
<br />
<label for="smtp">Adresse SMTP :</label>
<input type="text" name="smtp" id="smtp" size="40" class="calage1" />
<br />
<label for="nbre_mails">Nombre de mails :</label>
<input type="text" name="nbre_mails" id="nbre_mails" size="40" />
<br />
<label for="mail_princ">Mail principal :</label>
<input type="text" name="mail_princ" id="mail_princ" size="40" class="calage" />
<br />
<label for="mp">Mot de passe :</label>
<input type="text" name="mp" id="mp" size="40" class="calage" />
<br />
<br />
<label for="text"><strong>Concernant le client :</strong></label>
<input type="hidden" id="text" name="text" />
<br />
<label for="nc">Nom client :</label>
<input type="text" name="nc" id="nc" size="40" class="calage4" />
<br />
<label for="pc">Prénom client :</label>
<input type="text" name="pc" id="pc" size="40" />
<br />
<label for="adresse">Adresse :</label>
<input type="text" name="adresse" id="adresse" size="40" class="calage13" />
<br />
<label for="cp">Code Postal :</label>
<input type="text" name="cp" id="cp" size="40" class="calage1" />
<br />
<label for="ville">Ville :</label>
<input type="text" name="ville" id="ville" size="40" class="calage14" />
<br />
<label for="tel">Téléphone :</label>
<input type="text" name="tel" id="tel" size="40" class="calage" />
<br />
<label for="portable">Portable :</label>
<input type="text" name="portable" id="portable" size="40" class="calage15" />
<br />
<label for="bouton" class="calage"> </label>
<input type="submit" name="bouton" id="bouton" value="Insérer" class="submit" />
</fieldset>
</form>
<?php
if (
!empty ($_POST['nd'])
&& !empty ($_POST['pop'])
&& !empty ($_POST['smtp'])
&& !empty ($_POST['nbre_mails']) && is_numeric($_POST ['nbre_mails'])
&& !empty ($_POST['mail_princ'])
&& !empty ($_POST['mp'])
&& isset($_POST['bouton']))
{
/* $req = mysql_query ("INSERT INTO `general` (`id_ndd`,`id_mail`,`id_client`,`id_ref`) VALUES ('$recup_id_ndd','$recup_id_mail','$recup_id_clt','$recup_id_ref')"); */
$req1 = mysql_query ("INSERT INTO `domaines` (`ndd`,`pop`,`smtp`,`nbre_mails`,`id_mail_princ`) VALUES ('$_POST[nd]','$_POST[pop]','$_POST[smtp]','$_POST[nbre_mails]','$_SESSION['id_mail']')");
$_SESSION['id_ndd'] = mysql_insert_id ();
$req2 = mysql_query ("INSERT INTO `clients` (`nom`,`prenom`,`adresse`,`cp`,`ville`,`tel`,`portable`,`id_ndd`) VALUES ('$_POST[nc]','$_POST[pc]','$_POST[adresse]','$_POST[cp]','$_POST[ville]','$_POST[tel]','$_POST[portable]','$_SESSION[id_ndd]'");
$_SESSION['id_mail'] = mysql_insert_id ();
$req3 = mysql_query ("INSERT INTO `mail` (`mail`,`mail_mdp`,`date`,`mail_princ`,`id_client`,id_mail`) VALUES ('$_POST[mail_princ]','$_POST[mp]','$_POST[time]','1','$_SESSION[id_client]','$_SESSION['id_mail']')");
$_SESSION['id_client'] = mysql_insert_id ();
//affichage pour voir si données bien enregistrées
echo '<br /> req1 : ' .$req1. '<br /> req2 : ' .$req2. '<br /> req3 : ' .$req3. '<br />';
if($req1 == 1 && $req2 == 1 && $req3 == 1){
$mess='Le nom de domaine <strong>' .$_POST ['nd']. '</strong> a bien été enregistré.';
}
else{
$mess='L\'enregistrement du nom de domaine <strong>' .$_POST['nd']. '</strong> a echoué.';
}
//récap de et affichage des données pour clients
$mess .= "\n".'<br />' ."\n";
$mess .= 'nom de domaine : <strong>' .$_POST['nd']. '</strong><br />' ."\n";
$mess .= 'adresse pop : <strong>' .$_POST['pop']. '</strong><br />' ."\n";
$mess .= 'adresse smtp : <strong>' .$_POST['smtp']. '</strong><br />' ."\n";
$mess .= 'nombre d\'emails : <strong>' .$_POST['nbre_mails']. '</strong><br />' ."\n";
$mess .= 'adresse principale : <strong>' .$_POST['mail_princ']. '</strong><br />' ."\n";
$mess .= 'mot de passe : <strong>' .$_POST['mp']. '</strong><br />' ."\n";
$mess .= 'date création : <strong>' .$_POST['time']. '</strong><br />' ."\n";
echo $mess.'<br />';
}
?>
<a href="insert_ndd.php" >Ajouter un nouveau nom de domaine.</a><br />
<a href="index.php" >Retour accueil administration.</a>
</div>
</body>
</html> |
Partager