$loc_sql="SELECT * FROM links AS L, interfaces AS I, interfaces AS X, devices as D WHERE I.device_id = D.device_id AND L.src_if = I.interface_id AND D.hostname LIKE '%vostron.net' AND D.hostname NOT LIKE 'cust.vostron.net' GROUP BY D.location ORDER BY D.device_id ASC";
$dev_sql="SELECT * FROM links AS L, interfaces AS I, interfaces AS X, devices as D WHERE D.location = '".$loc_data['location']."' AND I.device_id = D.device_id AND L.src_if = I.interface_id AND D.hostname LIKE '%vostron.net' AND D.hostname NOT LIKE '%cust.vostron.net' GROUP BY D.hostname";
$links_sql="SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, interfaces AS I, interfaces AS X, devices as D, devices as Y WHERE D.hostname LIKE '%vostron.net' AND I.device_id = D.device_id AND X.device_id = Y.device_id AND D.hostname NOT LIKE '%cust%' AND Y.hostname NOT LIKE '%cust%' AND L.src_if = I.interface_id AND X.interface_id = L.dst_if AND D.location = '".$loc_data['location']."' AND D.location = Y.location ORDER BY D.location DESC";
$sq=mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$src_if'"));
$dq=mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$dst_if'"));
$links_sql="SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, interfaces AS I, interfaces AS X, devices as D, devices as Y WHERE D.hostname LIKE '%vostron.net' AND I.device_id = D.device_id AND X.device_id = Y.device_id AND D.hostname NOT LIKE '%cust%' AND L.src_if = I.interface_id AND X.interface_id = L.dst_if AND D.location != Y.location AND D.hostname NOT LIKE '%cust.vostron.net' AND Y.hostname NOT LIKE '%cust.vostron.net' ORDER BY D.location DESC";
$sq=mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$src_if'"));
$dq=mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$dst_if'"));