Lines 1-6
Link Here
|
1 |
--- etc/rtg.php.orig 2010-07-04 03:49:22.836351752 +0100 |
1 |
--- etc/rtg.php.orig 2003-09-24 21:42:03.000000000 +0100 |
2 |
+++ etc/rtg.php 2010-07-04 03:54:55.955519331 +0100 |
2 |
+++ etc/rtg.php 2014-06-22 15:25:22.471477252 +0100 |
3 |
@@ -171,6 +171,9 @@ |
3 |
@@ -4,10 +4,8 @@ |
|
|
4 |
print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n"; |
5 |
|
6 |
/* Connect to RTG MySQL Database */ |
7 |
- $dbc=@mysql_connect ($host, $user, $pass) or |
8 |
- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or |
9 |
+ $dbc=@mysqli_connect ($host, $user, $pass, $db) or |
10 |
die ("MySQL Connection Failed, Check Configuration."); |
11 |
- mysql_select_db($db,$dbc); |
12 |
|
13 |
if ($PHP_SELF == "") { |
14 |
$PHP_SELF = "rtg.php"; |
15 |
@@ -37,17 +35,17 @@ |
16 |
# Determine router, interface names as necessary |
17 |
if ($rid && $iid) { |
18 |
$selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid[0]"; |
19 |
- $selectResult=mysql_query($selectQuery, $dbc); |
20 |
- $selectRow=mysql_fetch_object($selectResult); |
21 |
- $interfaces = mysql_num_rows($selectResult); |
22 |
+ $selectResult=mysqli_query($dbc, $selectQuery); |
23 |
+ $selectRow=mysqli_fetch_object($selectResult); |
24 |
+ $interfaces = mysqli_num_rows($selectResult); |
25 |
$name = $selectRow->name; |
26 |
$description = $selectRow->description; |
27 |
$speed = ($selectRow->speed)/1000000; |
28 |
$router = $selectRow->router; |
29 |
} else if ($rid && !$iid) { |
30 |
$selectQuery="SELECT name AS router from router where rid=$rid"; |
31 |
- $selectResult=mysql_query($selectQuery, $dbc); |
32 |
- $selectRow=mysql_fetch_object($selectResult); |
33 |
+ $selectResult=mysqli_query($dbc, $selectQuery); |
34 |
+ $selectRow=mysqli_fetch_object($selectResult); |
35 |
$router = $selectRow->router; |
36 |
} |
37 |
|
38 |
@@ -71,8 +69,8 @@ |
39 |
if (!$rid && !$iid) { |
40 |
echo "<SELECT NAME=\"rid\" SIZE=10>\n"; |
41 |
$selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name"; |
42 |
- $selectResult=mysql_query($selectQuery, $dbc); |
43 |
- while ($selectRow=mysql_fetch_object($selectResult)){ |
44 |
+ $selectResult=mysqli_query($dbc, $selectQuery); |
45 |
+ while ($selectRow=mysqli_fetch_object($selectResult)){ |
46 |
echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n"; |
47 |
} |
48 |
echo "</SELECT>\n"; |
49 |
@@ -91,8 +89,8 @@ |
50 |
|
51 |
echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; |
52 |
$selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name"; |
53 |
- $selectResult=mysql_query($selectQuery, $dbc); |
54 |
- while ($selectRow=mysql_fetch_object($selectResult)){ |
55 |
+ $selectResult=mysqli_query($dbc, $selectQuery); |
56 |
+ while ($selectRow=mysqli_fetch_object($selectResult)){ |
57 |
echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n"; |
58 |
} |
59 |
echo "</SELECT>\n"; |
60 |
@@ -152,8 +150,8 @@ |
61 |
$range="$range AND id=$iid[0]"; |
62 |
|
63 |
$selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]"; |
64 |
- $selectResult=mysql_query($selectQuery, $dbc); |
65 |
- $selectRow=mysql_fetch_object($selectResult); |
66 |
+ $selectResult=mysqli_query($dbc, $selectQuery); |
67 |
+ $selectRow=mysqli_fetch_object($selectResult); |
68 |
echo "<TABLE BORDER=0>\n"; |
69 |
echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n"; |
70 |
echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n"; |
71 |
@@ -165,12 +163,15 @@ |
72 |
echo "<P>\n"; |
73 |
|
74 |
#$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range"; |
75 |
- #$selectResult=mysql_query($selectQuery, $dbc); |
76 |
- #if (mysql_num_rows($selectResult) <= 0) { |
77 |
+ #$selectResult=mysqli_query($dbc, $selectQuery); |
78 |
+ #if (mysqli_num_rows($selectResult) <= 0) { |
79 |
# print "<BR>No Data Found on Interface for Given Range.<BR>\n"; |
4 |
#} |
80 |
#} |
5 |
#else { |
81 |
#else { |
6 |
$args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8"; |
82 |
$args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8"; |
Lines 10-16
Link Here
|
10 |
foreach ($iid as $value) { |
86 |
foreach ($iid as $value) { |
11 |
$args="$args&iid=$value"; |
87 |
$args="$args&iid=$value"; |
12 |
} |
88 |
} |
13 |
@@ -181,8 +184,11 @@ |
89 |
@@ -181,8 +182,11 @@ |
14 |
if ($borderb) $args = "$args&borderb=$borderb"; |
90 |
if ($borderb) $args = "$args&borderb=$borderb"; |
15 |
if ($aggr) $args = "$args&aggr=yes"; |
91 |
if ($aggr) $args = "$args&aggr=yes"; |
16 |
if ($percentile) $args = "$args&percentile=$nth"; |
92 |
if ($percentile) $args = "$args&percentile=$nth"; |
Lines 23-29
Link Here
|
23 |
foreach ($iid as $value) { |
99 |
foreach ($iid as $value) { |
24 |
$args="$args&iid=$value"; |
100 |
$args="$args&iid=$value"; |
25 |
} |
101 |
} |
26 |
@@ -192,9 +198,13 @@ |
102 |
@@ -192,13 +196,17 @@ |
27 |
if ($borderb) $args = "$args&borderb=$borderb"; |
103 |
if ($borderb) $args = "$args&borderb=$borderb"; |
28 |
if ($aggr) $args = "$args&aggr=yes"; |
104 |
if ($aggr) $args = "$args&aggr=yes"; |
29 |
if ($percentile) $args = "$args&percentile=$nth"; |
105 |
if ($percentile) $args = "$args&percentile=$nth"; |
Lines 39-41
Link Here
|
39 |
# } |
115 |
# } |
40 |
} |
116 |
} |
41 |
|
117 |
|
|
|
118 |
-mysql_close($dbc); |
119 |
+mysqli_close($dbc); |
120 |
?> |
121 |
|
122 |
<P> |