-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert_user.php
More file actions
91 lines (81 loc) · 2.41 KB
/
insert_user.php
File metadata and controls
91 lines (81 loc) · 2.41 KB
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
<?php
session_start();
include ("util.php");
ecritEntete("$(document).ready(function(){
var ".'$pseudo'." = $('#login'),
".'$mdp'." = $('#pass'),
".'$confirmation'." = $('#confirmation'),
".'$mail'." = $('#mail'),
".'$envoi'." = $('#submit');
".'$confirmation'.".keyup(function(){
if($(this).val() != ".'$mdp'.".val()){ // si la confirmation est différente du mot de passe
$(this).css({ // on rend le champ rouge
borderColor : 'red',
color : 'red'
});
}
else{
$(this).css({ // si tout est bon, on le rend vert
borderColor : 'green',
color : 'green'
});
}
});
".'$envoi'.".click(function(e){
if( ".'$mdp'.".val() != ".'$confirmation'.".val() || !verifier(".'$pseudo'.") || !verifier(".'$mail'.") || !verifier(".'$pass'.") ){
e.preventDefault(); // on annule la fonction par défaut du bouton d'envoi
alert('argument not valid');
}
});
function verifier(champ){
if(champ.val() == ''){ // si le champ est vie.preventDefault(); // on annule la fonction par défaut du bouton d'envoide
".'$erreur'.".css('display', 'block'); // on affiche le message d'erreur
champ.css({ // on rend le champ rouge
borderColor : 'red',
color : 'red'
});
return false;
}else{
$(this).css({ // si tout est bon, on le rend vert
borderColor : 'green',
color : 'green'
});
return true;
}
}
});
");
ecritHeaderMenu();
// create formulaire
if( checkConnection() ){
echo "<section> Your are connected with ".$_SESSION["id"]."</section>";
}else{
?>
<section>
<div id="txtHint" ></div>
<form id="connexion" action="add_user.php" method="POST">
<p>
<label>Login</label>
<input type="text" id="login" placeholder="Login..." name="login" size="100"/>
</p>
<p>
<label>Mot de Pass</label>
<input type="password" id="pass" name="pass"/>
</p>
<p>
<label>Retapez votre mot de Pass</label>
<input type="password" id="confirmation" name="confirmation"/>
</p>
<p>
<label>Mail</label>
<input type="text" id="mail" placeholder="login@mail.com" name="mail"/>
</p>
<p>
<input type="submit" id="submit" />
</p>
</form>
</section>
<?php
}
ecritFin();
?>