-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_verify.php
36 lines (31 loc) · 720 Bytes
/
admin_verify.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
<?php
session_start();
if(!isset($_POST['submit'])){
echo "Something wrong! Check again!";
exit;
}
require_once "./functions/database_functions.php";
$conn = db_connect();
$name = trim($_POST['name']);
$pass = trim($_POST['pass']);
if($name == "" || $pass == ""){
echo "Name or Pass is empty!";
exit;
}
// get from db
$query = "SELECT * from admin where name='".$name."' AND pass='".$pass."' limit 1";
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result)==1){
$_SESSION['admin'] = true;
header("Location: admin_book.php");
exit;
}
else{
echo "Name or pass is wrong. Check again!";
$_SESSION['admin'] = false;
exit;
}
if(isset($conn)) {
mysqli_close($conn);
}
?>