$arpTable = `{$location} | grep eth0`; $arpSplitted = split("\n", $arpTable); $remoteIp = "HWaddr"; $remoteIp = str_replace(".", "\\.", $remoteIp); foreach ($arpSplitted as $value) { $valueSplitted = split(" ", $value); foreach ($valueSplitted as $spLine) { if (preg_match("/{$remoteIp}/", $spLine)) { $ipFound = true; } if ($ipFound) { reset($valueSplitted); foreach ($valueSplitted as $spLine) { if (preg_match("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $spLine)) { return $spLine; } } } $ipFound = false; } } return false; } $ver_voiper = file_parser("/etc/ver_voiper"); $ver_asterisk = file_parser_asterisk("/etc/ver_asterisk"); $ver_zaptel = file_parser_simple("/etc/ver_zaptel"); $ver_libpri = file_parser_simple("/etc/ver_libpri"); $ver_vcti = file_parser("/etc/ver_vcti"); $serial = file_parser_simple("/etc/voiper_serial"); $serial_pn = file_parser_serial_pn("/etc/voiper_pn"); $sshd_conf = file_parser_sshd_conf("/etc/ssh/sshd_config");
$sysnetwork = file_parser("/etc/sysconfig/network"); $hostname = $_REQUEST['hostname']; $ip = $_REQUEST['ip']; $netmask = $_REQUEST['netmask']; $gateway = $_REQUEST['gateway']; isset($_REQUEST['haip']) ? $haip = $_REQUEST['haip'] : ($haip = "off"); $gatewayswitch = $_REQUEST['gatewayswitch']; exec("sudo /var/www/html/private/networkconfig/networkconfig.sh \"{$hostname}\" \"{$ip}\" \"{$netmask}\" \"{$gateway}\" \"{$haip}\" \"{$gatewayswitch}\""); unset($hostname); unset($ip); unset($netmask); unset($gateway); unset($haip); unset($gatewayswitch); } $clustercheck = file_parser_serial_pn("/etc/voiper_pn"); $ifcfg = file_parser("/etc/sysconfig/network-scripts/ifcfg-eth0"); $sysnetwork = file_parser("/etc/sysconfig/network"); if ($clustercheck) { $ifcfgha = file_parser("/etc/sysconfig/network-scripts/ifcfg-eth0:0"); $haip = $ifcfgha["IPADDR"]; $hostname = $sysnetwork["HOSTNAME"]; } else { $hostname = $sysnetwork["HOSTNAME"]; } $netmask = $ifcfg["NETMASK"]; $gateway = $sysnetwork["GATEWAY"]; $ip = $ifcfg["IPADDR"]; $gatewayswitch = "0"; if ($gateway == "") { $gateway = $ifcfg["GATEWAY"];