--- etc/rtg.php.orig 2003-09-24 20:42:03 UTC +++ etc/rtg.php @@ -1,146 +1,152 @@ \n\n
\n"; + print "\n\n\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 == "") { + if (!isset($PHP_SELF) || $PHP_SELF == "") { $PHP_SELF = "rtg.php"; - $errors = $_GET['errors']; - $scalex = $_GET['scalex']; - $scaley = $_GET['scaley']; - $aggr = $_GET['aggr']; - $percentile = $_GET['percentile']; - $nth = $_GET['nth']; - $xplot = $_GET['xplot']; - $yplot = $_GET['yplot']; - $borderb = $_GET['borderb']; - $iid = $_GET['iid']; - $rid = $_GET['rid']; - $syear = $_GET['syear']; - $eyear = $_GET['eyear']; - $smonth = $_GET['smonth']; - $emonth = $_GET['emonth']; - $sday = $_GET['sday']; - $eday = $_GET['eday']; - $shour = $_GET['shour']; - $ehour = $_GET['ehour']; - $smin = $_GET['smin']; - $emin = $_GET['emin']; + $errors = isset($_GET['errors'])?$_GET['errors']:""; + $scalex = isset($_GET['scalex'])?$_GET['scalex']:""; + $scaley = isset($_GET['scaley'])?$_GET['scaley']:""; + $aggr = isset($_GET['aggr'])?$_GET['aggr']:""; + $percentile = isset($_GET['percentile'])?$_GET['percentile']:""; + $nth = isset($_GET['nth'])?$_GET['nth']:""; + $xplot = isset($_GET['xplot'])?$_GET['xplot']:""; + $yplot = isset($_GET['yplot'])?$_GET['yplot']:""; + $borderb = isset($_GET['borderb'])?$_GET['borderb']:""; + $iid = isset($_GET['iid'])?$_GET['iid']:""; + $rid = isset($_GET['rid'])?$_GET['rid']:""; + $syear = isset($_GET['syear'])?$_GET['syear']:""; + $eyear = isset($_GET['eyear'])?$_GET['eyear']:""; + $smonth = isset($_GET['smonth'])?$_GET['smonth']:""; + $emonth = isset($_GET['emonth'])?$_GET['emonth']:""; + $sday = isset($_GET['sday'])?$_GET['sday']:""; + $eday = isset($_GET['eday'])?$_GET['eday']:""; + $shour = isset($_GET['shour'])?$_GET['shour']:""; + $ehour = isset($_GET['ehour'])?$_GET['ehour']:""; + $smin = isset($_GET['smin'])?$_GET['smin']:""; + $emin = isset($_GET['emin'])?$_GET['emin']:""; } # Determine router, interface names as necessary - if ($rid && $iid) { - $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]"; - $selectResult=mysql_query($selectQuery, $dbc); - $selectRow=mysql_fetch_object($selectResult); - $interfaces = mysql_num_rows($selectResult); + if (($rid != "") && ($iid != "")) { + $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`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" . + mysqli_real_escape_string($dbc, $iid[0]); + $selectResult=mysqli_query($dbc, $selectQuery); + $selectRow=mysqli_fetch_object($selectResult); + $interfaces = mysqli_num_rows($selectResult); $name = $selectRow->name; $description = $selectRow->description; $speed = ($selectRow->speed)/1000000; $router = $selectRow->router; - } else if ($rid && !$iid) { - $selectQuery="SELECT name AS router from router where rid=$rid"; - $selectResult=mysql_query($selectQuery, $dbc); - $selectRow=mysql_fetch_object($selectResult); + } else if (($rid != "") && ($iid == "")) { + $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" . + mysqli_real_escape_string($dbc, $rid); + $selectResult=mysqli_query($dbc, $selectQuery); + $selectRow=mysqli_fetch_object($selectResult); $router = $selectRow->router; } # Generate Title - echo "+ +
+\n"; +echo "
-
+
+
+
+