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
|
<?PHP
session_start();
//VERIFICATION DES IDENTIFIANTS UTILISATEUR
if(!isset($_SESSION['login_util']) OR !isset($_SESSION['mdp_util']))
{
header('Location: echec_ident2.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Gestion du parc informatique </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="format" href="styles/format.css" />
</head>
<?
//CONNEXION A LA BDD
$connexion = mysql_connect("localhost", $_SESSION['login_util'], $_SESSION['mdp_util']);
mysql_select_db("keinfor");
if($connexion == false)
{
?><H3 ALIGN="center"><?exit("ERREUR DE CONNEXION A LA BASE");?></H3><?
}
// PAGE DE CONFIRMATION AVANT INSERTION DANS LA BASE
// AVEC CERTAINS CHAMPS PRE REMPLIS
$mat_emp = htmlentities ($_POST['mat_emp']);
$nom_emp = htmlentities ($_POST['nom_emp']);
$prenom_emp = htmlentities ($_POST['prenom_emp']);
$mdp_session_emp = htmlentities ($_POST['mdp_session_emp']);
$mdp_crypto_emp = htmlentities ($_POST['mdp_crypto_emp']);
$mdp_mess_emp = htmlentities ($_POST['mdp_mess_emp']);
$mdp_bios_emp = htmlentities ($_POST['mdp_bios_emp']);
Function removeaccents($string)
{
$string= strtr($string,
"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
"aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
return $string;
}
// génération login et adresse messagerie
$adresse_mess_emp = (str_replace(" ", "",strtolower($prenom_emp))).".".(str_replace(" ", "",strtolower($nom_emp)))."@kea-partners.com";
$login_emp = strtolower(substr($prenom_emp, 0, 1).(str_replace(" ", "",$nom_emp)));
//suppréssion des accents
$adresse_mess_emp = removeaccents($adresse_mess_emp);
$login_emp = removeaccents($login_emp) ;
//recupération du matricule employé pour verif doublon dans la table
$tmp = mysql_query("SELECT mat_emp FROM employe WHERE mat_emp = '$mat_emp'");
$verif_emp = mysql_fetch_array($tmp);
// Vérification de non doublon dans la table
if ($verif_emp['mat_emp'] == $mat_emp )
{
?><H3 ALIGN="center"><?exit("LE MATRICULE EXISTE DEJA DANS LA BASE");?></H3><?
}
else
{
//affichage de la page pour confirmation
?>
<script language="JavaScript" src="veriform.js"></script>
<BODY>
<div style="width:600px;margin-left:100px;">
<fieldset>
<legend><b>Confirez-vous ces informations ?</b></legend> <!-- Titre du fieldset -->
<?
// si les opération d'insertions se sont bienp passées, affichage récapitulatif
?>
<table border=0 align="center">
<form name="ajout" enctype="multipart/form-data" action="insertion_crea_emp.php" method="post">
<INPUT TYPE=HIDDEN NAME="type_ins" value="emp">
<tr>
<td class="field">Matricule:</td>
<td class="value"><input type="texte" name="mat_emp" maxlength="6" size="7" value="<? echo $mat_emp; ?>"></td>
</tr>
<tr>
<td class="field">Nom :</td>
<td class="value"><input type="texte" name="nom_emp" value="<? echo $nom_emp; ?>">
</tr>
<tr>
<td class="field"> Prénom:</td>
<td class="value"><input type="texte" name="prenom_emp" value="<? echo $prenom_emp; ?>">
</tr>
<tr>
<td class="field">Login:</td>
<td class="calcule"><input type="texte" name="login_emp" value="<? echo $login_emp; ?>">
</tr>
<tr>
<td class="field">Mot de passe session :</td>
<td class="value"><input type="texte" name="mdp_session_emp" value="<? echo $mdp_session_emp; ?>">
</tr>
<tr>
<td class="field">Adresse de messagerie:</td>
<td class="calcule"><input type="texte" name="adresse_mess_emp" value="<? echo $adresse_mess_emp; ?>">
</tr>
<tr>
<td class="field">Mot de passe d adresse de messagerie :</td>
<td class="value"><input type="texte" name="mdp_mess_emp" value="<? echo $mdp_mess_emp; ?>">
</tr>
<tr>
<td class="field">Mot de passe Bios:</td>
<td class="value"><input type="texte" name="mdp_bios_emp" value="<? echo $mdp_bios_emp; ?>">
</tr>
<tr>
<td class="field">Mot de passe CRYPTO:</td>
<td class="value"><input type="texte" name="mdp_crypto_emp" value="<? echo $mdp_crypto_emp; ?>">
</tr>
</table>
</fieldset>
</div>
<h2><INPUT type="button" value="Confirmer" onclick="javascript:confirmutil();"></h2>
</body>
</html>
<?
} |
Partager