-
Notifications
You must be signed in to change notification settings - Fork 0
/
inscriptionadmin.php
132 lines (120 loc) · 3.71 KB
/
inscriptionadmin.php
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
<?php
$ma = 0;
if (isset($_POST["prenom"])) {
$prenom =$_POST["prenom"];
$nom =$_POST["nom"];
$sex =$_POST["sex"];
$date =$_POST["jour"]."/".$_POST["mois"]."/".$_POST["annee"];
$email =$_POST["email"];
$pass =$_POST["pass"];
try {
// VOUS DEVEZ MODIFIER ICI LES ATTRIBUTS CAR C EN FONCTION DE VOTRE BDD
$conn = new PDO("mysql:host=localhost;dbname=librarie", "root", "");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// set the PDO error mode to exception
}
catch(Exception $e)
{
echo "Connection failed: " . $e->getMessage();
}
$sql = "SELECT email FROM profil WHERE email=\"$email\"";
$query=$conn->query($sql);
$count=$query->rowCount();
if ($count==1) {
$ma = 2;
}
else
{
$sql ="INSERT INTO profil VALUES ('$email','$pass','$nom','$prenom','$date','$sex','images/profil_start.jpg','0')";
$req = $conn->query($sql);
header('Location: admin.php');
// C EST ICI QU ON REDIRIGE L UTILISATEUR SI LE MDP ET EMAIL CORRECT ( J AI CHOISIT CETTE PAGE MAIS CA PEUT ETRE CHANGE)
}
}
?>
<html>
<head>
<meta charset="utf-8" />
<title> Inscription </title>
<link rel ="stylesheet"
href="style.css"/>
<script src="script.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<?php include("barreoutils.php");?>
</head>
<h1 id="titreInscription">Echangeagram</h1>
<div class="login">
<form name="inscription" onSubmit="return formValidation();" action="inscriptionadmin.php" method="post">
<h2 id="inscriptionH2">Inscription d'un nouveau membre</h2>
<p>
<label for="prenom"></label>
<input type="text" name="prenom" placeholder="Prénom" required class="form inp2" />
<label for="nom"></label>
<input type="text" name="nom" placeholder="Nom" required class="form inp2" />
</p>
<p>
Sexe: <br>
<div id="sxe">
<input type="radio" name="sex" value="h"/> <label>Homme</label>
<input type="radio" name="sex" value="f"/> <label>Femme</label>
</div>
</p>
<p>Date de naissance : <br><br>
<table id="tab_date">
<!--<label></label>
<input type="date" name="date" class="inp form" id="design" required></code>-->
<tr>
<td>Jour <br></td>
<td>Mois <br></td>
<td>Année <br></td>
</tr>
<tr>
<td><label for="jour"></label>
<select name="jour" class="inp3">
<?php
for ($i=1 ; $i <=31; $i++)
{
echo '<option value="'.$i.'">'.$i.'</option>';
}
?>
</select></td>
<td><label for="mois"></label>
<select name="mois" class="inp3" placeholder="Nom">
<?php
for ($i=1 ; $i <=12; $i++)
{
echo '<option value="'.$i.'">'.$i.'</option>';
}
?>
</select></td>
<td><label for="annee"></label>
<select name="annee" class="inp3">
<?php
for ($i=1916 ; $i <=2016; $i++)
{
echo '<option value="'.$i.'">'.$i.'</option>';
}
?>
</select>
</td>
</tr>
</table>
</p>
<input type="email" name="email" placeholder="Adresse mail"required class="inp form" />
<p>
<p> <label for="pass"></label>
<input type="password" name="pass" placeholder="Mot de passe" class="inp form" minlength="6" required/>
</p>
<p> <label for="confipass"></label>
<input type="password" name="confipass" placeholder="Confirmation mot de passe" class="inp form" minlength="6" required/>
</p>
<label></label>
<input type="submit" value="Confirmer l'inscription" class="inp bouton" ></code>
</p>
</form>
</div>
<?php
if ($ma==2){
echo'<script > connexion(2);</script>';
}?>
</html>