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
|
<?php
require_once('connectionartisanat.php');
$erreur_mail=0;
session_start();
if(isset($_POST['inscription'])&&isset($_POST['txtnom'])&&isset($_POST['txtprenom'])&&isset($_POST['txtadresse'])&&
isset($_POST['txtville'])&&isset($_POST['txtcp'])&&isset($_POST['txttel'])&&isset($_POST['txtmail'])&&
isset($_POST['txtpass'])&&isset($_POST['txtstatut'])&&$_POST['inscription']=="OK" ){
$txtmail=trim($_POST['txtmail']);
$sql1="SELECT email FROM artisanat.client WHERE client.email='$txtmail'";
$res1=mysql_query($sql1)or die('Erreur sur la requête : '.$sql2.'<br/>'.mysql_error());
$nbrc=mysql_num_rows($res1);
if($nbrc==0){
$erreur_mail=0;
$sql2="INSERT INTO artisanat.client (nom, prenom, adresse, ville, cp, telephone, email, pass, statut)
VALUES ('$_POST[txtnom]',
'$_POST[txtprenom]',
'$_POST[txtadresse]',
'$_POST[txtville]',
'$_POST[txtcp]',
'$_POST[txttel]',
'$_POST[txtmail]',
'$_POST[txtpass]',
'$_POST[txtstatut]' )";
$res2=mysql_query($sql2)or die('Erreur sur la requête : '.$sql2.'<br/>'.mysql_error());
$clientID=mysql_insert_id();
$statut="client";
session_register("clientID");
session_register("statut");
header("Location:commande.php");
}
else {
$erreur_mail=1;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
.Style1 {color: #FF0000}
-->
</style>
</head>
<body>
<?php
if($erreur_mail==1){
$erreur_mail=0;
echo'<p align="center"><img src="../images/erreur.jpeg" width="48" height="44" /></p>
<p align="center" class="Style1">l\'e-mail existe déja </p>
<p align="center" class="Style1">choisissez un autre e-mail ! </p>';
}
?>
<form id="form1" name="form1" method="post" action="inscription.php">
<table width="500" border="2" align="center" style=" text-align:right">
<tr>
<td width="104">Nom : </td>
<td width="378"><div align="center">
<label>
<input name="txtnom" type="text" id="txtnom" value="<?php echo isset($_POST['txtnom'])?$_POST['txtnom']:'' ?>" />
</label>
</div></td>
</tr>
<tr>
<td>Prenom : </td>
<td><div align="center">
<label>
<input name="txtprenom" type="text" id="txtprenom" value="<?php echo isset($_POST['txtprenom'])?$_POST['txtprenom']:'' ?>" />
</label>
</div></td>
</tr>
<tr>
<td>Adresse</td>
<td><div align="center">
<input name="txtadresse" type="text" id="txtadresse" value="<?php echo isset($_POST['txtadresse'])?$_POST['txtadresse']:'' ?>" />
</div></td>
</tr>
<tr>
<td>Ville : </td>
<td><div align="center">
<input name="txtville" type="text" id="txtville" value="<?php echo isset($_POST['txtville'])?$_POST['txtville']:'' ?>" />
</div></td>
</tr>
<tr>
<td>CP : </td>
<td><div align="center">
<input name="txtcp" type="text" id="txtcp" value="<?php echo isset($_POST['txtcp'])?$_POST['txtcp']:'' ?>" />
</div></td>
</tr>
<tr>
<td>Téléphone : </td>
<td><div align="center">
<input name="txttel" type="text" id="txttel" value="<?php echo isset($_POST['txttel'])?$_POST['txttel']:'' ?>"/>
</div></td>
</tr>
<tr>
<td>e-mail : </td>
<td><div align="center">
<input name="txtmail" type="text" id="txtmail" value="<?php echo isset($_POST['txtmail'])?$_POST['txtmail']:'' ?>"/>
</div></td>
</tr>
<tr>
<td>Mot de Passe : </td>
<td><div align="center">
<input name="txtpass" type="text" id="txtpass" value="<?php echo isset($_POST['txtpass'])?$_POST['txtpass']:'' ?>" />
</div></td>
</tr>
<tr>
<td>Statut : </td>
<td><div align="center">
<select name="txtstatut" id="txtstatut">
<option value="C">C</option>
<option value="M">M</option>
</select>
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="inscription" type="hidden" id="inscription" value="OK" />
</div></td>
</tr>
<tr>
<td colspan="2"><label>
<div align="center">
<input type="submit" name="Submit" value="Valider" />
</div>
</label></td>
</tr>
</table>
</form>
</body>
</html> |
Partager