<?php

if (isset($_SERVER['REMOTE_ADDR'])) die();
/*
include_once('../../global.php');

// Generate DHCP server configuration
$File = fopen('/etc/dhcpd.conf', 'w');
fputs($File, "# DHCP Configuration file\n".
"authoritative;\n".
'option domain-name "zdechov.net";'."\n".
"server-name centrala;\n".
"ddns-update-style ad-hoc;\n".
"default-lease-time 86400;\n".
"max-lease-time 86400;\n".
"ddns-hostname centrala;\n".
"option domain-name-servers 192.168.0.1;\n".
"#option subnet-mask 255.255.0.0;\n\n".
"# nastaveni WINS serveru\n".
"option netbios-name-servers 192.168.0.1;\n".
"option netbios-dd-server 192.168.0.1;\n".
"option netbios-node-type 8;\n".
'option netbios-scope "";'."\n".
"server-identifier 192.168.0.1;\n\n");
for ($i = 0; $i <= $MaxSubnet; $i++)
{
  fputs($File, "subnet 192.168.".$i.".0 netmask 255.255.255.0 {\n".
  "  range 192.168.".$i.".128 192.168.".$i.".254;\n".
  "  option broadcast-address 192.168.".$i.".255;\n".
  "  option routers 192.168.".$i.".1;\n");
  $DbResult = $Database->select('hosts', '*', "IP LIKE '192.168.".$i."%' ORDER BY IP");
  while ($Row = $DbResult->fetch_array())
  {
    $Data = $Row['name'];
    if (strlen($Data) < 9) $Data .= "\t";
    fputs($File, "  host ".$Data."\t{ fixed-address ".$Row['IP'].";\thardware ethernet ".$Row['MAC']."; }\n");
  }

  fputs($File, "}\n\n");
}
fclose($File);
*/
