Редакция 47 | Редакция 130 | К новейшей редакции | Авторство | Сравнить с предыдущей | Последнее изменение | Открыть журнал | Скачать | RSS
<?php
require_once dirname(__FILE__)."/lib/init.php";
include "./inc/header.htm";
$net = abs(intval($_GET["net"]));
if($net==0) {
echo "<table>\n";
echo "<tr>\n";
echo "<th>Сеть</th><th>Подсети</th><th colspan='2'>Ресурсы</th>\n";
echo "</tr>\n";
$nets =& $db->query("SELECT * FROM networks");
while ($nets->fetchInto($info_nets, DB_FETCHMODE_ASSOC)) {
$first = true;
$res =& $db->query("SELECT *
FROM res_net_stat
JOIN resources ON resources.id = res_net_stat.resource_id
WHERE res_net_stat.network_id=".$info_nets['id']);
while ($res->fetchInto($info_res, DB_FETCHMODE_ASSOC)) {
echo "<tr>\n";
if ($first) {
echo " <td rowspan='".$res->numRows()."'><a href='./networks.php?net=".$info_nets['id']."'>".$info_nets['network']."</a></td>\n";
echo " <td rowspan='".$res->numRows()."'>";
$snets =& $db->query("SELECT * FROM subnets WHERE network_id=".$info_nets['id']);
if ($snets->numRows()==0) echo "<i>Нет данных.</i>";
while ($snets->fetchInto($info_snets, DB_FETCHMODE_ASSOC)) {
echo $info_snets['subnet']."<br>";
}
echo " </td>\n";
$first = false;
}
echo " <td><img src='".$info_res['picture']."' alt='logo'></td>\n<td><a href='./details.php?res=".$info_res['id']."'>".$info_res['resource']."</a></td>\n";
echo "</tr>\n";
}
}
echo "</table>";
}
else {
$nets =& $db->query("SELECT * FROM networks WHERE id=".$net);
while ($nets->fetchInto($info_nets, DB_FETCHMODE_ASSOC)) {
echo "<h2>niX-FILES в ".$info_nets['network']."</h2>";
echo "Сайт: <a href='".$info_nets['link']."'>".$info_nets['link']."</a>";
echo "<br><br>Проекты:<br> | ";
$ress =& $db->query("SELECT * FROM res_net_stat JOIN resources ON resources.id=res_net_stat.resource_id WHERE network_id=".$net);
while ($ress->fetchInto($info_ress, DB_FETCHMODE_ASSOC)) {
echo "<img src='".$info_ress['picture']."' alt='".$info_res['resource']."'> <a href='./details.php?res=".$info_ress['id']."'>".$info_ress['resource']."</a> | ";
}
echo "<br><br>В подсетях:";
$snets =& $db->query("SELECT * FROM subnets WHERE network_id=".$net);
if ($snets->numRows()==0) echo "<br><i>Нет данных.</i>";
echo "<table>";
while ($snets->fetchInto($info_snets, DB_FETCHMODE_ASSOC)) {
echo "<tr><td>".$info_snets['subnet']."</td></tr>";
}
echo "</table>";
}
}
include "./inc/footer.htm";
?>