-
Notifications
You must be signed in to change notification settings - Fork 13
/
viewport.php
54 lines (43 loc) · 1.89 KB
/
viewport.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
<?php
include_once('functions.php');
$viewhost = $_GET['host'];
$viewport = @$_GET['port'];
$start = "";
if(isset($_GET['duration'])) {
$start = "&duration=" . $_GET['duration'];
}
?>
<html>
<head>
<title>FITB - View port - <?php echo "$viewhost - $viewport" ?></title>
<link rel="stylesheet" href="fitb.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</head>
<body>
<?php include_once('header.php'); # includes the <div> for the header ?>
<div id="wrap">
<?php include_once('side.php'); # includes the <div> for the side bar ?>
<div id="main">
<h2>View port - <?php echo "$viewhost - $viewport" ?></h2>
<?php
$link = connectToDB();
$result = mysqli_query($link, 'SELECT * FROM ports WHERE host="' . mysqli_real_escape_string($link, $viewhost). '" AND safename="' . mysqli_real_escape_string($link, $viewport) . '" ORDER BY lastpoll DESC, safename ASC');
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$staletag = "";
if ((time() - $row['lastpoll']) > $staleage) {
$staletag = "STALE: ";
}
$friendlytitle = urlencode("{$staletag}{$viewhost} - {$row['name']} ({$row['alias']})");
$basegraphurl = "graph.php?host={$viewhost}&rrdname={$viewhost}-{$row['safename']}&type={$row['graphtype']}{$start}&friendlytitle={$friendlytitle}";
echo '<a href="view' . $basegraphurl . '">';
echo '<img src="' . $basegraphurl . '&height=100&width=400" alt="'.$row['alias'].'"></a>';
}
} else {
echo "This host does not exist, or it has not been polled yet. ";
}
?>
<div>
</div>
</body>
</html>