-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
80 lines (61 loc) · 1.85 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
<?php
require 'vendor/autoload.php';
Dotenv::load(__DIR__);
if(isset($_GET['trigger']) && $_GET['trigger'] == 1) {
error_reporting(E_ALL);
exec('gpio write 7 0');
usleep(1000000);
exec('gpio write 7 1');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Doorman Beta</title>
<link rel="apple-touch-icon" href="apple-touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-iphone-retina-display.png" />
<link rel="stylesheet" href="/assets/stylesheets/screen.css" type="text/css">
<script type="text/javascript" src="/assets/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/assets/js/script.js"></script>
<meta name="viewport" content="width=device-width">
</head>
<body>
<header class="wrapper">
<h1>Doorman<span class="beta">Beta</span></h1>
</header>
<script type="text/javascript">
moveOnMax =function (field, nextFieldID) {
if (field.value.length == 1) {
document.getElementById(nextFieldID).focus();
}
}
</script>
<?php
error_reporting(E_ALL ^ E_NOTICE);
// Define your username and password
$password = getenv('password');
if (!($_POST['txtPassword'] === $password)) {
?>
<div class="wrapper main">
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="txtpassword">Password:</label>
<input title="Enter your password" name="txtPassword" type="number" pattern="[0-9]*" />
<input type="submit" name="Submit" value="Login" class="button" />
</form>
</div>
<?php
}
else {
?>
<div class="wrapper main">
<a href='/?trigger=1' class="button closed"></a>
</div>
<?php
}
?>
<footer>
Raspberry Pi Powered
</footer>
</body>
</html>