<?php
include "../zorbconf.php";
mysql_connect($dbhost,$dbuname,$dbpass);
$get=$_GET;
$getkeys=array_keys($get);
$getcount=count($get) -1;
while($getcount>=0)
{
$key=$getkeys[$getcount];
$variable=$get[$key]; $$key=$variable;
$getcount=$getcount-1;
}
$ID=$_POST["ID"];
$ip=$_POST["ip"];
$tab=mysql_list_tables($dbname);
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'DTD/xhtml1-transitional.dtd'>";
echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n";
echo "<head>\n";
echo " <title>ZorbIPtraffic 0.01</title>";
echo " <meta http-equiv='Content-Type' content='text/html; charset=utf-8'></meta>";
echo "</head>\n";
echo "<body BGcolor='E6E3F4'>";
if ($choix=="del")
{
$ret=mysql_query("delete from zhost where id='$ID'");
echo "Deleted";
}
if ($choix=="add")
{
$ret=mysql_query("insert into zhost (ip,hostname) values ('$ip','$ip')");
echo $ip." Added";
}
echo "<table>";
echo " <tr>";
echo "<FORM ACTION=\"zorbadmin.php?choix=del\" METHOD=\"post\" ENCTYPE=\"application/x-www-form-urlencoded\">";
echo "<td> Hostname </td><td>";
echo "<SELECT NAME=\"ID\" SIZE=\"1\">";
$ret=mysql_query("select id,hostname from zhost order by hostname");
while(($row = mysql_fetch_array($ret)))
{
echo "<OPTION VALUE=\"".$row["id"]."\" SELECTED>".$row["hostname"]."</OPTION>";
}
echo "</SELECT>";
echo "</td><td><input TYPE=\"SUBMIT\" VALUE=\"Delete\"></td>";
echo "</FORM>";
echo "</tr>";
echo "<tr>";
echo "<FORM ACTION=\"zorbadmin.php?choix=add\" METHOD=\"post\" ENCTYPE=\"application/x-www-form-urlencoded\">";
echo "<td> IP </td><td><INPUT type='text' name='ip'/></td>";
echo "<td><input TYPE=\"SUBMIT\" VALUE=\"Add New IP\"></td>";
echo "</FORM>";
echo "</tr>";
echo "</tables>";
echo "</body>";
echo "</html>";