-
Notifications
You must be signed in to change notification settings - Fork 0
/
verification.php
160 lines (126 loc) · 5.56 KB
/
verification.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
session_start();
include('./includes/connect.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verification du compte</title>
<!-- google font -->
<link href='https://fonts.googleapis.com/css?family=Alice' rel='stylesheet'>
<!-- bootstrap-css -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- font awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- sweetalert2 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<!-- css file -->
<link rel="stylesheet" href="css/style.css?v=<?php echo time(); ?>">
</head>
<body>
<main class="login-form mt-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header bg-success text-light">Verifier Votre Compte</div>
<div class="card-body">
<form action="" method="POST" class='mr-0 mt-4 text-right m-auto'>
<div class="form-group row mb-3">
<label for="code" class="col-md-4 col-form-label text-md-right">Code de Verfication</label>
<div class="col-md-6 text-right">
<input type="text" id="code" class="text-right form-control" name="otp_code" autofocus placeholder='Le code que vous avez recu via email'>
</div>
</div>
<div class="col-md-6 offset-md-4 text-center">
<input class='ml-3 btn btn-success' style='width:93%' type="submit" value="Verifier le compte" name="verifie_compte">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
<?php
if(isset($_POST["verifie_compte"])){
if(isset($_SESSION['otp'])){
$otp = $_SESSION['otp'];
}else{
$otp = "error_otp";
echo "<script>Swal.fire({position: 'center',
icon: 'error',
title: 'On ne peux pas traiter votre demande',
showConfirmButton: true}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
window.open('./verification.php','_self')
)
}else{
window.open('./verification.php','_self')
}
});
</script>";
}
if(isset($_SESSION['mail'])){
$email = $_SESSION['mail'];
}else{
$email = "error_email";
echo "<script>Swal.fire({position: 'center',
icon: 'error',
title: 'On ne peux pas traiter votre demande',
showConfirmButton: true}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
window.open('./verification.php','_self')
)
}else{
window.open('./verification.php','_self')
}
});
</script>";
}
if(isset($_POST['otp_code'])){
$otp_code = $_POST['otp_code'];
}else{
$otp_code = "error_otp_code";
}
if($otp_code == 'error_otp_code'){
echo "<script>Swal.fire({position: 'center',
icon: 'error',
title: 'Entrer un code',
showConfirmButton: true});
</script>";
}
if($otp != $otp_code){
echo "<script>Swal.fire({position: 'center',
icon: 'error',
title: 'Le code de verification est incorrecte',
showConfirmButton: true});
</script>";
}else{
$modifier_utilisateur = "UPDATE utilisateurs SET verifie=:verifie WHERE email_utilisateur=:email_utilisateur";
$modifier= $con->prepare($modifier_utilisateur);
$modifier->execute(array('verifie' => 1,'email_utilisateur' => $email));
echo "<script>Swal.fire({position: 'center',
icon: 'success',
title: 'Vous avez verifier votre email avec succes, Vous pouver se connecter',
showConfirmButton: true}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
window.open('./login.php','_self')
)
}else{
window.open('./login.php','_self')
}
});</script>";
}
}
?>
<!-- bootstrap-JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
</body>
</html>