-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.php
More file actions
37 lines (31 loc) · 972 Bytes
/
index.php
File metadata and controls
37 lines (31 loc) · 972 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
<?php
$jasondata = file_get_contents("data.jason");
$jason = json_decode($jasondata , true);
session_start();
if ( !empty($_REQUEST['username']) && !empty($_REQUEST['password']) ) {
foreach ($jason['users'] as $value) {
if( $_REQUEST['username'] === $value['name'] && $_REQUEST['password'] === $value['password'] ){
$url = $value['access_level'] .".php" ;
echo $url;
$_SESSION['access_level'] = $value['access_level'];
//echo $_SESSION['access_level'];
header("Location: ./$url");
die();
}
}
echo "Your username or password invalid";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form method="post" >
Name: <input type="text" placeholder="Enter Your name" name="username" value=""><br/>
Password: <input type="password" placeholder="Enter Password " name="password" value=""><br/>
<input type="submit" name="submit">
</form>
</body>
</html>