Location: PHPKode > scripts > eNetman > enetman-20050830/enetman/html/modules/02networkinterfaces/bottom.php
<?

include "functions.php";

$ID = $_GET['ID'];
$view = $_GET['view'];
$page = $_GET['page'];

echo "</td></tr>";
echo "<tr><td colspan=5>&nbsp;</td></tr>";
echo "<tr><td colspan=5 bgcolor='cccccc'><img src='' width='1' height='1'></td></tr>";
echo "<tr><td colspan=5>&nbsp;</td></tr>";
echo "<tr><td colspan=5 valign='top'>";

$query = "SELECT * FROM ports WHERE serverID = $ID";

$result = mysql_query($query);

$num = mysql_num_fields($result) + 1;
$colspan = $num + 1;
$rnum = 0 ;

echo "<table bgcolor='000000' cellpadding=0 border=0 cellspacing=0 align='center' width='100%'>\n";
echo "\t<tr>\n";
echo "\t\t<td>\n";
echo "\t\t\t<table cellpadding=0 border=0 cellspacing=1 width='100%'>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=$colspan align='center' bgcolor='#D3DCE3'><h3><b>Network Interfaces</b></td>\n";
echo "\t\t\t\t</tr>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=$num align='center' bgcolor='#CCCCCC'><img src='' width=1 height=1></td>\n";
echo "\t\t\t\t</tr>\n";

echo "\t\t\t\t<tr>\n";
while($rnum != $num) {
        $title = mysql_field_name($result, $rnum);
        if(($title != "ID") && ($title != "") && ($title != "serverID")) {
                echo "\t\t\t\t\t<td bgcolor='ffffff' align='center'><b>$title</b></td>\n";
        }
        $rnum++;
}
echo "\t\t\t\t\t<td bgcolor='ffffff'>&nbsp;</td>\n";
echo "\t\t\t\t</tr>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=$colspan bgcolor='#CCCCCC'><img src='' width='1' height='2'></td>\n";
echo "\t\t\t\t</tr>\n";

$color = "#FFFFFF";

echo "<form name='addport' method='post' action='index.php?page=$page&view=$view&ID=$ID'>\n";
echo "<input type='hidden' name='action' value='add,port'>\n";
echo "\t\t\t\t<tr>\n";

$rnum = 0;
while($rnum != $num) {
        $title = mysql_field_name($result, $rnum);               
        if($title == "networkcardType"){
                echo "\t\t\t\t\t<td bgcolor='#FFFFFF' align='center'><select name='$title'>";
                $tquery = "SELECT ID,Type FROM types WHERE dataType = 'Network Type'";
                $tresult = mysql_query($tquery);
                while($tline = mysql_fetch_array($tresult)) {
                        $tID = $tline["ID"];
                        $tType = $tline["Type"];
                        echo "<option value='$tID'>$tType</option>";
                }
                echo "</select></td>";
        } elseif($title == "Interface"){
                echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<input class='frmStyle' type='text' size=8 name='$title'>\n";
        } elseif($title == "MAC"){
                echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<input class='frmStyle' type='text' size=14 name='$title'>\n";
        } elseif (($title != "ID") && ($title != "") && ($title != "serverID")) {
                echo "\t\t\t\t\t<td bgcolor='#FFFFFF' align='center'><input class='frmStyle' type='text' name='$title' size='13'></td>\n";
        }
        $rnum++;       
}

echo "<td colspan=2 align='center' bgcolor='#FFFFFF'><input type='button' value='Add' class='frmStyle' onClick='addport.submit();'></td>\n";
echo "</tr>";
echo "</form>";

$result = mysql_query($query);
$num = mysql_num_rows($result);

if($num) {
        echo "\t\t\t\t<tr>\n";
        echo "\t\t\t\t\t<td colspan=$colspan bgcolor='#CCCCCC'><img src='' width='1' height='2'></td>\n";
        echo "\t\t\t\t</tr>\n";
}

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "\t\t\t\t<tr>\n";
        echo "<form name='updateport$line[ID]' method='post' action='index.php?page=edit-server.php&view=$view&ID=$ID'>\n";
        echo "<input type='hidden' name='action' value='update,port,$line[ID]'>\n";
        $n=0;
        foreach ($line as $col_value) {
                $title = mysql_field_name($result, $n);
                if($title == "networkcardType") {
                        echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<select name='$title'>";
                        $tquery = "SELECT ID,Type FROM types WHERE dataType = 'Network Type'";
                        $tresult = mysql_query($tquery);
                        while($tline = mysql_fetch_array($tresult)) {
                                $tID = $tline["ID"];
                                $tType = $tline["Type"];
                                echo "<option value='$tID' ";
                                if($col_value == $tID) { echo "selected"; }
                                echo ">$tType</option>";
                        }
                        echo "</select></td>";
                } elseif($title == "Interface"){
                        echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<input class='frmStyle' type='text' size=8 name='$title' value='$col_value'>\n";
                } elseif($title == "MAC"){
                        echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<input class='frmStyle' type='text' size=14 name='$title' value='$col_value'>\n";
                } elseif(($title != "ID") &&  ($title != "") && ($title != "serverID")) {
                        echo "\t\t\t\t\t<td bgcolor='$color' align='center'>&nbsp;<input class='frmStyle' type='text' size=13 name='$title' value='$col_value'>\n";
                }
                $n++;
        }
        echo "<td colspan=2 align='center' bgcolor='$color'><input type='button' value='Update' class='frmStyle' onClick='updateport$line[ID].submit();'>&nbsp;<input type='button' value='Delete' class='frmStyle'onClick=\"deleteme('index.php?page=edit-server.php&view=$view&ID=$ID','port','$line[ID]');\"></td>\n";
        echo "</form>\n";
        echo "\t\t\t\t</tr>\n";
        $color = "#FFFFFF";
}
echo "\t\t\t</table>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
echo "</table>\n";

mysql_free_result($result);
?>
Return current item: eNetman