forked from CentralCorp/CentralCorp-Panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
25 lines (23 loc) · 641 Bytes
/
auth.php
File metadata and controls
25 lines (23 loc) · 641 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
<?php
$configFilePath = 'conn.php';
if (!file_exists($configFilePath)) {
header('Location: setdb');
exit();
}
require_once 'connexion_bdd.php';
if (!isset($_SESSION['user_token']) || !isset($_SESSION['user_email'])) {
header('Location: account/connexion');
exit();
}
$email = $_SESSION['user_email'];
$token = $_SESSION['user_token'];
$stmt = $pdo->prepare("SELECT id FROM users WHERE email = :email AND token = :token");
$stmt->bindParam(':email', $email);
$stmt->bindParam(':token', $token);
$stmt->execute();
$utilisateur = $stmt->fetch();
if (!$utilisateur) {
header('Location: account/connexion');
exit();
}
?>