mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Creating networking interface to change between Static / Dynamic IPs
This commit is contained in:
parent
908f0de8cb
commit
77316709e1
118
includes/networking.php
Executable file
118
includes/networking.php
Executable file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
include_once( 'includes/status_messages.php' );
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function DisplayNetworkingConfig(){
|
||||
|
||||
$status = new StatusMessages();
|
||||
|
||||
exec("ls /sys/class/net | grep -v lo", $interfaces);
|
||||
|
||||
foreach($interfaces as $interface) {
|
||||
exec("ip a show $interface",$$interface);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel panel-heading">
|
||||
<i class="fa fa-sitemap fa-fw"></i> Configure Networking
|
||||
</div>
|
||||
<div class="panel panel-body">
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active"><a href="#summary" aria-controls="summary" role="tab" data-toggle="tab">Summary</a></li>
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '<li role="presentation"><a href="#'.$interface.'" aria-controls="'.$interface.'" role="tab" data-toggle="tab">'.$interface.'</a></li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="summary">
|
||||
Current Settings:<br />
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">'.$interface.'</div>
|
||||
<div class="panel-body">
|
||||
';
|
||||
foreach(${$interface} as $line) {
|
||||
echo $line.'<br />';
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
foreach($interfaces as $interface) {
|
||||
echo '<div role="tabpanel" class="tab-pane" id="'.$interface.'">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<h4>Adapter IP Address Settings:</h4>
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-primary active">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-dhcp" autocomplete="off" checked>DHCP
|
||||
</label>
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-static" autocomplete="off">Static IP
|
||||
</label>
|
||||
</div>
|
||||
<h4>Enable Fallback to Static Option:</h4>
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-primary active">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-failover" autocomplete="off" checked>Enabled
|
||||
</label>
|
||||
<label class="btn btn-danger">
|
||||
<input type="radio" name="'.$interface.'-addresstype" id="'.$interface.'-nofailver" autocomplete="off">Disabled
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<h4>Static IP Options</h4>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-ipaddress">IP Address</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-ipaddress" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-netmask">Subnet Mask</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-netmask" placeholder="255.255.255.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-gateway">Default Gateway</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-gateway" placeholder="0.0.0.0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="'.$interface.'-dnssvr">DNS Server</label>
|
||||
<input type="text" class="form-control" id="'.$interface.'-dnssvr" placeholder="0.0.0.0">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
15
index.php
15
index.php
@ -13,7 +13,7 @@
|
||||
* @author Lawrence Yau <sirlagz@gmail.com>
|
||||
* @author Bill Zimmerman <billzimmerman@gmail.com>
|
||||
* @license GNU General Public License, version 3 (GPL-3.0)
|
||||
* @version 1.2.2
|
||||
* @version 1.2.3
|
||||
* @link https://github.com/billz/raspap-webgui
|
||||
* @see http://sirlagz.net/2013/02/08/raspap-webgui/
|
||||
*/
|
||||
@ -50,6 +50,7 @@ include_once( 'includes/dhcp.php' );
|
||||
include_once( 'includes/hostapd.php' );
|
||||
include_once( 'includes/system.php' );
|
||||
include_once( 'includes/configure_client.php' );
|
||||
include_once( 'includes/networking.php' );
|
||||
|
||||
$output = $return = 0;
|
||||
$page = $_GET['page'];
|
||||
@ -117,7 +118,7 @@ $csrf_token = $_SESSION['csrf_token'];
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="index.php">RaspAP Wifi Portal v1.2.2</a>
|
||||
<a class="navbar-brand" href="index.php">RaspAP Wifi Portal v1.2.3</a>
|
||||
</div>
|
||||
<!-- /.navbar-header -->
|
||||
|
||||
@ -129,10 +130,13 @@ $csrf_token = $_SESSION['csrf_token'];
|
||||
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> Configure client</a>
|
||||
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> Configure WiFi Client</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> Configure hotspot</a>
|
||||
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> Configure Hotspot</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php?page=network_conf"><i class="fa fa-sitemap fa-fw"></i> Configure Networking</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php?page=dhcpd_conf"><i class="fa fa-exchange fa-fw"></i> Configure DHCP Server</a>
|
||||
@ -181,6 +185,9 @@ $csrf_token = $_SESSION['csrf_token'];
|
||||
case "wpa_conf":
|
||||
DisplayWPAConfig();
|
||||
break;
|
||||
case "network_conf":
|
||||
DisplayNetworkingConfig();
|
||||
break;
|
||||
case "hostapd_conf":
|
||||
DisplayHostAPDConfig();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user