-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathform.php
87 lines (66 loc) · 2.68 KB
/
form.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style3.css" />
</head>
<body>
<?php
session_start();
require('config.php');
require("functions.php");
if (isset($_REQUEST['firstname'], $_REQUEST['secondname'], $_REQUEST['email'], $_REQUEST['password'], $_REQUEST['telephone'], $_REQUEST['niveauetude'])){
$firstname = stripslashes($_POST['firstname']);
$firstname = mysqli_real_escape_string($con, $firstname);
$secondname = stripslashes($_POST['secondname']);
$secondname = mysqli_real_escape_string($con, $secondname);
$email = stripslashes($_POST['email']);
$email = mysqli_real_escape_string($con, $email);
$password = stripslashes($_POST['password']);
$password = mysqli_real_escape_string($con, $password);
$telephone = stripslashes($_POST['telephone']);
$telephone = mysqli_real_escape_string($con, $telephone);
$niveauetude = stripslashes($_POST['niveauetude']);
$niveauetude = mysqli_real_escape_string($con, $niveauetude);
$query = "INSERT INTO `users` ( firstname ,secondname, email , password , telephone, niveauetude)
VALUES ('$firstname', '$secondname','$email', '$password', '$telephone', '$niveauetude')";
$res = mysqli_query($con, $query);
if($res){
echo "<div class='sucess'>
<h3>Vous êtes inscrit avec succès.</h3>
<p>Cliquez ici pour vous <a href='login.php'>connecter</a>
</p>
</div>";
header("Location: login.php");
die;
}
else echo "prob";
mysqli_close($con);
}
else{
?>
<form class="box" action="" method="post">
<form action="index.html" method="post">
<h1>Sign Up</h1>
<fieldset>
<label for="firstname">Fist Name:</label>
<input type="text" id="firstname" name="firstname">
<label for="secondname">Second Name:</label>
<input type="text" id="secondname" name="secondname">
<label for="email">Email:</label>
<input type="email" id="mail" name="email" required />
<label for="password">Password:</label>
<input type="password" id="password" name="password" required />
<label for="cpassword">Confirm password:</label>
<input type="password" id="cpassword" name="cuser_password" required />
<label for="cpassword">téléphone:</label>
<input type="number" name="telephone" required /></br>
<label for="cpassword"> niveau d'etude:</label>
<input type="text" name="niveauetude" required /></br>
</fieldset>
<button type="submit">Sign Up</button>
</form>
<p class="box-register">Déjà inscrit? <a href="login.php">Connectez-vous ici</a></p>
</form>
<?php } ?>
</body>
</html>