-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
98 lines (87 loc) · 2.74 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
92
93
94
95
96
97
98
<?php
require 'config/mysql.php';
require 'config/openvpn.php';
require 'include/page_vars.php';
require 'include/page_start.php';
require 'include/page_end.php';
require 'functions/functions.php';
$stats = parseLog("/etc/openvpn/status.log");
mysql_connect(get_mysql_host(), get_mysql_user(), get_mysql_pass());
mysql_select_db(get_mysql_db());
$result = mysql_query("SELECT sum(BytesSent) as 'totalsend', sum(BytesReceived) as 'totalreceived' FROM stats WHERE LastRef LIKE '%".date("M")." ".date("j")."%".date("Y")."%'") or die(mysql_error());
echo $page_start;
?>
<section class="content-header">
<h1>Home</h1>
<ol class="breadcrumb">
<li><a href="index.php"><i class="fa fa-home"></i> Home</a></li>
</ol>
</section>
<br/>
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<?php
$connected_clients = 0;
if(array_key_exists('users', $stats))
{
$connected_clients = count($stats['users']);
}
echo '
<h3>' . $connected_clients . '</h3>
';
?>
<p>Connected Clients</p>
</div>
<div class="icon">
<i class="fa fa-users"></i>
</div>
<a href="status.php" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<?php
$data_sent = 0;
$data_recv = 0;
while ($row = mysql_fetch_assoc($result))
{
$data_sent = sizeformat($row['totalsend']);
$data_recv = sizeformat($row['totalreceived']);
}
echo ' <h3>' . $data_sent . '</h3>';
?>
<p>Download</p>
</div>
<div class="icon">
<i class="fa fa-download"></i>
</div>
<a href="status.php" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<?php
echo '
<h3>' . $data_recv . '</h3>
';
?>
<p>Upload</p>
</div>
<div class="icon">
<i class="fa fa-upload"></i>
</div>
<a href="status.php" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
</div>
<?php
echo $page_end;
?>