-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
129 lines (115 loc) · 3.29 KB
/
index.php
File metadata and controls
129 lines (115 loc) · 3.29 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
$name = $msg= '';
$ipv4 = $_SERVER['REMOTE_ADDR'];
if (isset($_POST['name'])) {
$request_time = DateTime::createFromFormat('U.u', $_SERVER['REQUEST_TIME_FLOAT'])->format("Y-m-d H:i:s.u");
preg_match('/[A-Za-z0-9]+/', $_POST['name'], $m);
if (isset($m) && !empty($m)) {
$name = $m[0];
file_put_contents('log.txt', "$request_time => $name [$ipv4]\n", FILE_APPEND);
$msg= '<h2 class="alert success">BUZZ ok! ('.$request_time.')</h2>';
} else $msg= '<h2 class="alert danger">Richiesta non registrata, nome non corretto (consentite solo lettere e numeri)</h2>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BUZZER</title>
<style>
.button {
display: inline-block;
padding: 0.75rem 1.25rem;
border-radius: 10rem;
color: #fff;
text-transform: uppercase;
font-size: 1rem;
letter-spacing: 0.15rem;
transition: all 0.3s;
position: relative;
overflow: hidden;
z-index: 1;
border: 0;
}
.button:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #0cf;
border-radius: 10rem;
z-index: -2;
}
.button:before {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 100%;
background-color: #008fb3;
transition: all 0.3s;
border-radius: 10rem;
z-index: -1;
}
.button:hover {
color: #fff;
}
.button:hover:before {
width: 100%;
}
/* optional reset for presentation */
* {
font-family: Arial;
text-decoration: none;
font-size: 20px;
}
.container {
padding-top: 50px;
margin: 0 auto;
width: 100%;
text-align: center;
}
h1 {
text-transform: uppercase;
font-size: 0.8rem;
margin-bottom: 2rem;
color: #777;
}
.alert {
position: relative;
padding: 1rem 1rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
text-transform: uppercase;
}
.success {
color: #0f5132;
background-color: #d1e7dd;
border-color: #badbcc;
}
.danger {
color: #842029;
background-color: #f8d7da;
border-color: #f5c2c7;
}
</style>
</head>
<body>
<div class="container">
<?=$msg;?>
<form action="" method="post">
<h1>Sei
<input type="text" style="font-size: 16px;" name="name" placeholder="Nome" value="<?= $name; ?>" required>
[<?= $ipv4; ?>]
</h1>
<button class="button" type="submit">BUZZ</button>
</form>
</div>
</body>
</html>