-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.php
More file actions
123 lines (117 loc) · 3.85 KB
/
index.php
File metadata and controls
123 lines (117 loc) · 3.85 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
<?php
require 'config/config.php';
$dataName = ($zone == 'EU') ? (($lang == 'FR') ? "Octets" : "Bytes") : 'Bits';
$requestLang = ($lang == 'FR') ? 'Requetes' : 'Requests';
$perSecondLang = ($lang == 'FR') ? 'par seconde' : 'per second';
?>
<title><?php echo $sitename; ?></title>
<html>
<head>
<?php error_log(" \r\n", 3, 'data/layer7-logs'); ?>
</head>
<body>
<div id="layer7"></div>
<br/>
<div id="layer4"></div>
<br/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"
integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg=="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/8.2.2/highcharts.js"
integrity="sha512-PpL09bLaSaj5IzGNx6hsnjiIeLm9bL7Q9BB4pkhEvQSbmI0og5Sr/s7Ns/Ax4/jDrggGLdHfa9IbsvpnmoZYFA=="
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/8.2.2/modules/exporting.min.js"
integrity="sha512-DuFO4JhOrZK4Zz+4K0nXseP0K/daLNCrbGjSkRzK+Zibkblwqc0BYBQ1sTN7mC4Kg6vNqr8eMZwLgTcnKXF8mg=="
crossorigin="anonymous"
></script>
<script id="source" language="javascript" type="text/javascript">
$(document).ready(function () {
Highcharts.createElement(
"link",
{
href: "https://fonts.googleapis.com/css?family=Unica+One",
rel: "stylesheet",
type: "text/css",
},
null,
document.getElementsByTagName("head")[0]
);
let layer7 = new Highcharts.Chart({
chart: {
renderTo: "layer7",
defaultSeriesType: "spline",
events: {
load: requestData(0),
},
},
title: {
text: "<?php echo $Layer7Title;?>",
},
xAxis: {
type: "datetime",
tickPixelInterval: 150,
maxZoom: 20 * 1000,
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
title: {
text: "<?php echo $requestLang;?> <?php echo $perSecondLang;?>",
margin: 80,
},
},
series: [
{
name: "<?php echo $requestLang;?>/s",
data: [],
},
],
});
let layer4 = new Highcharts.Chart({
chart: {
renderTo: "layer4",
defaultSeriesType: "spline",
events: {
load: requestData(1),
},
},
title: {
text: "<?php echo $Layer4Title;?>",
},
xAxis: {
type: "datetime",
tickPixelInterval: 150,
maxZoom: 20 * 1000,
},
yAxis: {
minPadding: 0.2,
maxPadding: 0.2,
title: {
text: "<?php echo $dataName;?> <?php echo $perSecondLang;?>",
margin: 80,
},
},
series: [
{
name: "<?php echo $dataName;?>/s",
data: [],
},
],
});
function requestData(type) {
$.ajax({
url: "data/" + (!type ? "layer7" : "layer4") + ".php",
success: function (point) {
var series = (!type ? layer7 : layer4).series[0],
shift = series.data.length > 20;
series.addPoint(point, true, shift);
setTimeout(() => requestData(type), 1000);
},
cache: false,
});
}
});
</script>
</body>
</html>