diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php index 2c9ae7aee..94cebf6fc 100644 --- a/html/pages/devices.inc.php +++ b/html/pages/devices.inc.php @@ -27,8 +27,8 @@ print_optionbar_start(62); All OSes query('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`') as $data) { if ($data['os']) { @@ -43,8 +43,8 @@ while ($data = mysql_fetch_assoc($query)) All Versions query('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`') as $data) { if ($data['version']) { @@ -60,8 +60,7 @@ while ($data = mysql_fetch_assoc($query)) All Platforms query('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`') as $data) { if ($data['hardware']) { @@ -76,8 +75,8 @@ while ($data = mysql_fetch_assoc($query)) All Featuresets query('SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`') as $data) { if ($data['features']) { @@ -93,7 +92,8 @@ while ($data = mysql_fetch_assoc($query)) All Locations DeviceOperating SystemPlatformUptime/Location'); -$device_query = mysql_query($sql); -while ($device = mysql_fetch_assoc($device_query)) +foreach($db->query($sql) as $device) { if (device_permitted($device['device_id'])) { diff --git a/includes/static-config.php b/includes/static-config.php index 71bf38bcc..0cb965b35 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -939,6 +939,13 @@ if (!$observium_link) } $observium_db = mysql_select_db($config['db_name'], $observium_link); +try { + $db = new PDO('mysql:host='.$config['db_host'].';dbname='.$config['db_name'], $config['db_user'], $config['db_pass']); +} catch (PDOException $e) { + print "Error!: " . $e->getMessage() . ""; + die(); +} + # Set some times needed by loads of scripts (it's dynamic, so we do it here!) $now = time();