PDA

View Full Version : создание нового модуля


zibit
13.05.2008, 20:00
Создал новый модуль отображается нормально не не отображаются Блоки, как сделать так чтоб они отображались. Спасибо
<?php
if (!defined('MODULE_FILE')){
die ("You can't access this file directly...");
}
include('const.php');
require_once('mainfile.php');
define('index_file', true);
$module_name = basename(dirname(_FILE_));
include('header.php');
OpenTable();
?>
<table border=1 width=100% hight=100%>
<tr>
<td>
<table border=1>
<?php
if ($traf=='')
{
$result = mysql_query("select * from traffic where ipport1=80",$conn);
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $row['date'];
echo "</td>";
echo "<td>";
echo $row['type'];
echo "</td>";
echo "<td>";
echo $row['ip1'];
echo "</td>";
echo "<td>";
echo $row['ipport1'];
echo "</td>";
echo "<td>";
echo $row['ip2'];
echo "</td>";
echo "<td>";
echo $row['ipport2'];
echo "</td>";
echo "<td>";
echo $row['bytes'];
echo "</td>";
echo "</tr>";
}
}
if ($traf==1)
{
$result = mysql_query("select sum(bytes) as bytes,ip1,date,ip2 from traffic group by ip1,date,ip2 Order by date,ip2");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $row['date'];
echo "</td>";
echo "<td>";
echo $row['type'];
echo "</td>";
echo "<td>";
echo $row['ip1'];
echo "</td>";
echo "<td>";
echo $row['ipport1'];
echo "</td>";
echo "<td>";
echo $row['ip2'];
echo "</td>";
echo "<td>";
echo $row['ipport2'];
echo "</td>";
echo "<td>";
$bytes = round($row['bytes']/1024);
$bytes = round($bytes/1024);
echo $bytes;
echo "</td>";
echo "</tr>";
}
}

if ($traf==2)
{
$result = mysql_query("select sum(bytes) as bytes,date,ip2,ipport1 from traffic where ip2 like '%192.168.0.%' and ip1 not like '%192.168.0.%' group by date,ip2,ipport1 Order by date,ip2,ipport1");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $row['date'];
echo "</td>";
echo "<td>";
echo "<a href=index.php?traf=4&ip=".$row['ip2']."&date=".$row['date']."&port=".$row['ipport1'].">".$row['ip2']."</a>";
echo "</td>";
echo "<td>";
echo $row['ipport1'];
echo "</td>";
echo "<td>";
echo $row['bytes']/1024/1024;
echo "</td>";
echo "</tr>";
}
}
if ($traf==3)
{
$result = mysql_query("select sum(bytes) as bytes,date,ip1,ipport2 from traffic where ip1 like '%192.168.0.%' and ip2 not like '%192.168.0.%' group by date,ip1,ipport2 Order by date,ip1,ipport2");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $row['date'];
echo "</td>";
echo "<td>";
echo "<a href=index.php?traf=5&ip=".$row['ip1']."&date=".$row['date']."&port=".$row['ipport2'].">".$row['ip1']."</a>";
echo "</td>";
echo "<td>";
echo $row['ipport2'];
echo "</td>";
echo "<td>";
echo $row['bytes']/1024/1024;
echo "</td>";
echo "</tr>";
}
}
if ($traf==4 || $traf==5)
{
if ($traf==4)
{
$result = mysql_query("select sum(bytes) as bytes,date,ip2 as ip,ipport1 as port,ip1 as ip_n from traffic where ip2 = '".$ip."' and ipport1=".$port." and date='".$date."' group by date,ip2,ipport1,ip1 Order by date,ip1,ipport2");
}
if ($traf==5)
{
$result = mysql_query("select sum(bytes) as bytes,date,ip1 as ip,ipport2 as port,ip2 as ip_n from traffic where ip1 = '".$ip."' and ipport2=".$port." and date='".$date."' group by date,ip1,ipport2,ip2 Order by date,ip1,ipport2");
}
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $row['date'];
echo "</td>";
echo "<td>";
echo $row['ip'];
echo "</td>";
echo "<td>";
echo $row['port'];
echo "</td>";
echo "<td>";
echo $row['ip_n'];
echo "</td>";
echo "<td>";
echo $row['bytes']/1024/1024;
echo "</td>";
echo "</tr>";
}
}

?>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
<?php
CloseTable2();
include('footer.php');
?>

Soniks
14.05.2008, 20:58
zibit может у вас стоит запрет в теме на отображ блоков на главной по условию define('index_file', true);