-
Notifications
You must be signed in to change notification settings - Fork 0
/
front.php
91 lines (72 loc) · 1.58 KB
/
front.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
<?php
$path = dirname(__FILE__);
$path1 = explode("/",$path,-1);
$path1[count($path1)+1]='db.conf';
$finalpath = implode("/",$path1);
$handle = fopen($finalpath, "r");
while (!feof($handle)) {
$line = fgets($handle);
$data = explode("'",$line);
if($data[0]=='host=>')
{
$host= $data[1];
}
elseif($data[0]=='port=>')
{
$port= $data[1];
}
elseif($data[0]=='username=>')
{
$username= $data[1];
}
elseif($data[0]=='password=>')
{
$password= $data[1];
}
elseif($data[0]=='database=>')
{
$database= $data[1];
}
}
header("refresh: 10;");
// Create connection
$conn = mysql_connect($host, $username, $password,$database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysql_connect_error());
}
//echo "Connected successfully<br>";
mysql_select_db('ENIGMA',$conn);
$result = mysql_query("SELECT * FROM metrics",$conn);
?>
<div>
<style>thead {color:black;}
table,th,td
{border:1px solid black;}
</style>
</head>
<body>
<table border="1" style="width:300px">
<thead>
<tr style = "padding: 2px;">
<th style = "text-align: center;">SourceIP/port</th>
<th style = "text-align: center;">DestinationIP/port</th>
<th style = "text-align: center;">RTT(seconds)</th>
<!--<th style = "text-align: center;">RTT</th> -->
</tr>
<?php
$i=0;
while($row = mysql_fetch_array($result)) {
?>
<tr style = "padding: 2px;">
<td><?php echo $row["ips"]; ?></td>
<td><?php echo $row["ipd"]; ?></td>
<td><?php echo $row["rrt"]; ?></td>
<!--<td><?php echo $row["sst"]; ?></td>-->
</tr>
<?php
$i++;
}
?>
</table>
</div>