-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.php
More file actions
39 lines (37 loc) · 914 Bytes
/
validation.php
File metadata and controls
39 lines (37 loc) · 914 Bytes
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
<?php
require_once 'config/setup.php';
session_start ();
if ($_GET['login'] == "" || $_GET['cle'] == "")
header('Location: index.php');
$login = $_GET['login'];
$cle = $_GET['cle'];
try
{
$stmt = $db_con->prepare("SELECT * FROM user_db WHERE login=:login");
if ($stmt->execute(array(":login"=>$login)) && $row = $stmt->fetch())
{
$clebdd = $row['cle'];
$actif = $row['actif'];
}
if($actif == '1')
{
echo "Votre compte est déjà actif !";
}
else
{
if($cle == $clebdd)
{
$stmt = $db_con->prepare("UPDATE user_db SET actif = 1 WHERE login =:login ");
$stmt->execute(array(':login'=>$login));
header('Location: login.php');
}
else
{
echo "Erreur ! Votre compte ne peut être activé...";
}
}
}
catch(PDOException $e){
echo $e->getMessage();
}
?>