/tmp/dhcpddata',$temp ); system( 'sudo cp /tmp/dhcpddata '. RASPI_DNSMASQ_CONFIG, $return ); if( $return == 0 ) { $status->addMessage('Dnsmasq configuration updated successfully', 'success'); } else { $status->addMessage('Dnsmasq configuration failed to be updated', 'danger'); } } else { error_log('CSRF violation'); } } exec( 'pidof dnsmasq | wc -l',$dnsmasq ); $dnsmasq_state = ($dnsmasq[0] > 0); if( isset( $_POST['startdhcpd'] ) ) { if (CSRFValidate()) { if ($dnsmasq_state) { $status->addMessage('dnsmasq already running', 'info'); } else { exec('sudo service dnsmasq start', $dnsmasq, $return); if ($return == 0) { $status->addMessage('Successfully started dnsmasq', 'success'); $dnsmasq_state = true; } else { $status->addMessage('Failed to start dnsmasq', 'danger'); } } } else { error_log('CSRF violation'); } } elseif( isset($_POST['stopdhcpd'] ) ) { if (CSRFValidate()) { if ($dnsmasq_state) { exec('sudo service dnsmasq stop', $dnsmasq, $return); if ($return == 0) { $status->addMessage('Successfully stopped dnsmasq', 'success'); $dnsmasq_state = false; } else { $status->addMessage('Failed to stop dnsmasq', 'danger'); } } else { $status->addMessage('dnsmasq already stopped', 'info'); } } else { error_log('CSRF violation'); } } else { if( $dnsmasq_state ) { $status->addMessage('Dnsmasq is running', 'success'); } else { $status->addMessage('Dnsmasq is not running', 'warning'); } } exec( 'cat '. RASPI_DNSMASQ_CONFIG, $return ); $conf = ParseConfig($return); $arrRange = explode( ",", $conf['dhcp-range'] ); $RangeStart = $arrRange[0]; $RangeEnd = $arrRange[1]; $RangeMask = $arrRange[2]; preg_match( '/([0-9]*)([a-z])/i', $arrRange[3], $arrRangeLeaseTime ); switch( $arrRangeLeaseTime[2] ) { case "h": $hselected = " selected"; break; case "m": $mselected = " selected"; break; case "d": $dselected = " selected"; break; } ?>
showMessages(); ?>
Expire time | MAC Address | IP Address | Host name | Client ID |
---|---|---|---|---|