-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecondfactor.php
More file actions
87 lines (71 loc) · 3.28 KB
/
Copy pathsecondfactor.php
File metadata and controls
87 lines (71 loc) · 3.28 KB
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
<?php
if(!session_start())
{
session_start();
}
if(!isset($_SESSION['email_id']))
header("Location:index.php");
require "Authenticator.php";
$Authenticator = new Authenticator();
if (!isset($_SESSION['auth_secret'])) {
$secret = $Authenticator->generateRandomSecret();
$_SESSION['auth_secret'] = $secret;
}
$qrCodeUrl = $Authenticator->getQR('myPHPnotes', $_SESSION['auth_secret']);
if (!isset($_SESSION['failed'])) {
$_SESSION['failed'] = false;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Authenticator</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta name="description" content="Implement Google like Time-Based Authentication into your existing PHP application. And learn How to Build it? How it Works? and Why is it Necessary these days."/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<link rel='shortcut icon' href='/favicon.ico' />
<style>
body,html {
height: 100%;
}
.bg {
/* The image used */
background-image: url("highsecurity.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body class="bg">
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3" style="background: white; padding: 20px; margin-top: 100px;">
<h1 style="text-align: center;">Scan the QR code</h1>
<p style="font-style: italic;margin-left: 140px;">Powered by Google Authenticator</p>
<hr>
<form action="home.php" method="post">
<div style="text-align: center;">
<?php if ($_SESSION['failed']): ?>
<div class="alert alert-danger" role="alert">
<strong>Oh snap!</strong> Invalid Code.
</div>
<?php
$_SESSION['failed'] = false;
?>
<?php endif ?>
<img style="text-align: center;;" class="img-fluid" src="<?php echo $qrCodeUrl ?>" alt="Verify this Google Authenticator"><br><br>
<input type="text" class="form-control" name="code" placeholder="******" style="font-size: xx-large;width: 200px;border-radius: 0px;text-align: center;display: inline;color: #0275d8;"><br> <br>
<button type="submit" class="btn btn-md btn-primary" style="width: 200px;border-radius: 0px;">Verify</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>