Changeset 37 for system/generators/dhcp.php
- Timestamp:
- Jan 31, 2008, 8:38:47 PM (17 years ago)
- Location:
- system
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
system
-
Property svn:ignore
set to
nohup.out
-
Property svn:ignore
set to
-
system/generators/dhcp.php
r1 r37 1 <? 2 include('global.php'); 3 include_once('../../html/is/db.php'); 4 DB_Init('localhost', 'root', '', 'is'); 1 <?php 2 include_once('../../html/global.php'); 5 3 6 4 // Generate DHCP server configuration 7 5 $File = fopen('/etc/dhcpd.conf', 'w'); 8 fputs($File, "# DHCP Configuration file\n".6 fputs($File, "# DHCP Configuration file\n". 9 7 "authoritative;\n". 10 8 'option domain-name "zdechov.net";'."\n". … … 22 20 'option netbios-scope "";'."\n". 23 21 "server-identifier 192.168.0.1;\n\n"); 24 for($i =0;$i<=$MaxSubnet;$i++)22 for($i = 0; $i <= $MaxSubnet; $i++) 25 23 { 26 fputs($File, "subnet 192.168.".$i.".0 netmask 255.255.255.0 {\n".24 fputs($File, "subnet 192.168.".$i.".0 netmask 255.255.255.0 {\n". 27 25 " range 192.168.".$i.".128 192.168.".$i.".254;\n". 28 26 " option broadcast-address 192.168.".$i.".255;\n". 29 27 " option routers 192.168.".$i.".1;\n"); 30 DB_Select('hosts','*',"IP LIKE '192.168.".$i."%' ORDER BY IP");31 while($Row = DB_Row())28 $DbResult = $Database->select('hosts', '*', "IP LIKE '192.168.".$i."%' ORDER BY IP"); 29 while($Row = $DbResult->fetch_array()) 32 30 { 33 31 $Data = $Row['name']; 34 if(strlen($Data) <9) $Data .= "\t";35 fputs($File, " host ".$Data."\t{ fixed-address ".$Row['IP'].";\thardware ethernet ".$Row['MAC']."; }\n");32 if(strlen($Data) < 9) $Data .= "\t"; 33 fputs($File, " host ".$Data."\t{ fixed-address ".$Row['IP'].";\thardware ethernet ".$Row['MAC']."; }\n"); 36 34 } 37 35 38 fputs($File, "}\n\n");36 fputs($File, "}\n\n"); 39 37 } 40 38 fclose($File);
Note:
See TracChangeset
for help on using the changeset viewer.