-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.php
91 lines (81 loc) · 2.6 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
// Start Session
session_start();
// Database connection
require __DIR__ . '/config/db_connection.php';
$db = DB();
// Application library ( with DemoLib class )
require __DIR__ . '/library/library.php';
$app = new DemoLib($db);
$login_error_message = '';
// check Login request
if (!empty($_POST['btnLogin'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if ($username == "") {
$login_error_message = 'Username field is required!';
} else if ($password == "") {
$login_error_message = 'Password field is required!';
} else {
$user_id = $app->Login($username, $password); // check user login
if($user_id > 0)
{
$_SESSION['user_id'] = $user_id; // Set Session
header("Location: validate_login.php"); // Redirect user to validate auth code
}
else
{
$login_error_message = 'Invalid login details!';
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>OTP - MFA/2FA BYPASS</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row jumbotron">
<div class="col-md-12">
<h2>
<center>MULTI-FACTOR BYPASS SIMULATION</center>
</h2>
<p>
<center>Note: This is a Vulnerable Multi-Factor Application</center>
</p>
</div>
</div>
<div class="row">
<div class="col-md-5 col-md-offset-3 well">
<h4>Login</h4>
<?php
if ($login_error_message != "") {
echo '<div class="alert alert-danger"><strong>Error: </strong> ' . $login_error_message . '</div>';
}
?>
<form action="index.php" method="post">
<div class="form-group">
<label for="">Username/Email</label>
<input type="text" name="username" class="form-control"/>
</div>
<div class="form-group">
<label for="">Password</label>
<input type="password" name="password" class="form-control"/>
</div>
<div class="form-group">
<input type="submit" name="btnLogin" class="btn btn-primary" value="Login"/>
</div>
</form>
<div class="form-group">
Not Registered Yet? <a href="registration.php">Register Here</a>
</div>
</div>
</div>
</div>
</body>
</html>