blob: 6d513265f364da6b419106a3ab5f4b27316d9d42 (
plain) (
blame)
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
|
<?php
session_start();
# IS LOGIN LEGITIMATE?
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email']) && isset($_POST['password'])) {
# DB CONNECT
try {
$user = "yota_user";
$password = "gahdeer6shai9hogai2sai4quuaj1eVu";
$database = "yota_call_db";
$conn = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM admins WHERE email=:email");
$stmt->bindParam(':email', $_POST['email']);
$stmt->execute();
$row = $stmt->fetch();
if (password_verify($_POST['password'], $row['password'])) {
$_SESSION['admin'] = true;
} else {
$_SESSION['admin'] = false;
}
} catch (PDOException $e) {
die("Error!: " . $e->getMessage());
}
$stmt=null;
$conn=null;
}
header("Location: admin.php");
|