aboutsummaryrefslogtreecommitdiff
path: root/net/rtg/files/patch-etc-95.php
blob: 9831f54f01cc2bdda61077d79f37b85a9fafabfc (plain) (blame)
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
--- etc/95.php.orig	2003-09-24 20:40:57 UTC
+++ etc/95.php
@@ -4,10 +4,8 @@
   print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
 
   /* Connect to RTG MySQL Database */
-  $dbc=@mysql_connect ($host, $user, $pass) or
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
      die ("MySQL Connection Failed, Check Configuration.");
-  mysql_select_db($db,$dbc);
 
   if ($PHP_SELF == "") {
     $PHP_SELF = "95.php";
@@ -50,8 +48,8 @@ function int_stats($statement, $dbc) {
   $max = $avg = $nintyfifth = 0;
   $rate = array();
 
-  $selectResult=mysql_query($statement, $dbc);
-  while ($selectRow=mysql_fetch_object($selectResult)){
+  $selectResult=mysqli_query($dbc, $statement);
+  while ($selectRow=mysqli_fetch_object($selectResult)){
     $counter = $selectRow->counter;
     $sample_secs = $selectRow->unixtime;
     $total += $counter;
@@ -89,9 +87,8 @@ Report: 95th percentile<BR>
 <?php
   echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
   if (($bt || $smonth)) { 
-    $dbc=@mysql_connect ($host, $user, $pass) or
-    $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
-    mysql_select_db($db,$dbc);
+    $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+      die ("MySQL Connection Failed, Check Configuration.");
     /* Format into GNU date syntax */
     if ($bt == "") {
       $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
@@ -104,11 +101,11 @@ Report: 95th percentile<BR>
     $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
 
     $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
-    $selectResult=mysql_query($selectQuery, $dbc);
-    if (mysql_num_rows($selectResult) <= 0) 
+    $selectResult=mysqli_query($dbc, $selectQuery);
+    if (mysqli_num_rows($selectResult) <= 0) 
       print "<BR>No Such Customer Found.<BR>\n";
     else {
-      while ($selectRow=mysql_fetch_object($selectResult)){
+      while ($selectRow=mysqli_fetch_object($selectResult)){
         $ids[$selectRow->id] = $selectRow->name; 
         $rids[$selectRow->id] = $selectRow->rid; 
 	$desc[$selectRow->id] = $selectRow->description;
@@ -127,8 +124,8 @@ Report: 95th percentile<BR>
       foreach($ids as $iid=>$name) {
 
         $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
-        $selectResult=mysql_query($selectQuery, $dbc);
-        $selectRow=mysql_fetch_object($selectResult);
+        $selectResult=mysqli_query($dbc, $selectQuery);
+        $selectRow=mysqli_fetch_object($selectResult);
 	$router = $selectRow->name;
 
         if ($yellow) $yellow = 0;
@@ -201,7 +198,7 @@ Report: 95th percentile<BR>
     echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
   }
 
-  if ($dbc) mysql_close($dbc);
+  if ($dbc) mysqli_close($dbc);
   echo "</FORM>\n";
 ?>
 <BR>