-
Notifications
You must be signed in to change notification settings - Fork 13
/
login.php
38 lines (26 loc) · 805 Bytes
/
login.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
<?php
include 'config.php';
session_start();
$username = $_POST['login'];
$password = $_POST['password'];
$username= $link->real_escape_string($username);
$password = $link->real_escape_string($password);
$password_hash = md5($password);
$result = mysqli_query($link, "SELECT id,is_admin,level ,image_url FROM `users` WHERE Username = '".$username."' AND Password='".$password_hash."' ");
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
if($row['id'] >0 )
{
$_SESSION["loginid"] = $row['id'];
$_SESSION["level"] = $row['level'];
$_SESSION["is_admin"] = $row['is_admin'];
$_SESSION["Username"] = $username;
$_SESSION["User_image"] = $row['image_url'];
echo "true";
}
else
{
echo "false";
}
}
?>