Subversion Repositories ALCASAR

Rev

Rev 3041 | Rev 3049 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3041 Rev 3042
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 3041 2022-07-20 21:06:54Z rexy $
2
# $Id: network.php 3042 2022-07-22 12:35:45Z rexy $
3
 
3
 
4
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
4
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
5
 
5
 
6
/********************
6
/********************
7
*  READ CONF FILES  *
7
*  READ CONF FILES  *
Line 379... Line 379...
379
			}
379
			}
380
		}
380
		}
381
		break;
381
		break;
382
	case 'enable_lan_ssh': // Activate SSH on LAN
382
	case 'enable_lan_ssh': // Activate SSH on LAN
383
		if (isset($_POST['sshlan'])) {
383
		if (isset($_POST['sshlan'])) {
384
			exec('sudo /usr/local/bin/alcasar-ssh.sh --on -l');
384
			exec('sudo /usr/local/bin/alcasar-ssh.sh --on -l -p'.escapeshellarg($_POST["ssh_port"]).' -i'.escapeshellarg($_POST["ssh_from"]),$output,$exitCode);
-
 
385
			if($exitCode === 1){
-
 
386
				echo("<html><script>if(!alert(`$l_error_bad_ip_port`)){window.location.href = window.location.href;}</script></html>");
-
 
387
			}else{
385
			header('Location: '.$_SERVER['PHP_SELF']);
388
				header('Location: '.$_SERVER['PHP_SELF']);
-
 
389
			}
386
		} else{
390
		} else{
387
			exec('sudo /usr/local/bin/alcasar-ssh.sh --off -l');
391
			exec('sudo /usr/local/bin/alcasar-ssh.sh --off -l');
388
			header('Location: '.$_SERVER['PHP_SELF']);
392
			header('Location: '.$_SERVER['PHP_SELF']);
389
		}
393
		}
390
		exit();	
394
		exit();	
Line 1200... Line 1204...
1200
	<tr>
1204
	<tr>
1201
		<td width="50%" align="center">
1205
		<td width="50%" align="center">
1202
			<div class="panel-row">
1206
			<div class="panel-row">
1203
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1207
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1204
					<input type="hidden" name="choix" value="enable_lan_ssh">
1208
					<input type="hidden" name="choix" value="enable_lan_ssh">
1205
					<input type="checkbox" name="sshlan" id="sshlan" <?= $conf['SSH_LAN'] === 'on' ? "checked": "" ?>> <b><?= $l_ssh_lan_activate ?></b><br><br>
1209
					<input type="checkbox" name="sshlan" id="sshlan" <?= $conf['SSH_LAN'] !== '0' ? "checked": "" ?> onchange="document.getElementById('sshtablelan').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_lan_activate ?></b><br><br>
-
 
1210
					<div id="sshtablelan" style="display:<?= $conf['SSH_LAN'] !== '0'? "block": "none" ?>">
-
 
1211
					<table cellspacing="2" cellpadding="3" border="1">
-
 
1212
						<tr>
-
 
1213
							<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
-
 
1214
						</tr>
-
 
1215
						<tr>
-
 
1216
							<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= $conf['SSH_LAN'] !== '0' ? $conf['SSH_LAN']:22 ?>" /></td>
-
 
1217
							<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= explode('/',$conf['SSH_ADMIN_FROM'])[0] ?>" /></td>		
-
 
1218
						</tr>
-
 
1219
					</table>
-
 
1220
					<p>Activer sur tout le LAN : 0.0.0.0</p>
-
 
1221
				</div>
1206
					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
1222
					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
1207
				</form>
1223
				</form>
1208
			</div>
1224
			</div>
1209
		</td>
1225
		</td>
1210
		<td width="50%" align="center">
1226
		<td width="50%" align="center">
1211
			<div class="panel-row">
1227
			<div class="panel-row">
1212
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1228
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1213
				<input type="hidden" name="choix" value="enable_wan_ssh">
1229
				<input type="hidden" name="choix" value="enable_wan_ssh">
1214
				<input type="checkbox" name="togglessh" id="togglessh" <?= is_numeric($conf['SSH_WAN'])? "checked": "" ?> onchange="document.getElementById('sshtable').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_wan_activate ?></b><br><br>
1230
				<input type="checkbox" name="togglessh" id="togglessh" <?= $conf['SSH_WAN'] !== '0'? "checked": "" ?> onchange="document.getElementById('sshtablewan').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_wan_activate ?></b><br><br>
1215
				<div id="sshtable" style="display:<?= is_numeric($conf['SSH_WAN'])? "block": "none" ?>">
1231
				<div id="sshtablewan" style="display:<?= $conf['SSH_WAN'] !== '0'? "block": "none" ?>">
1216
					<table cellspacing="2" cellpadding="3" border="1">
1232
					<table cellspacing="2" cellpadding="3" border="1">
1217
						<tr>
1233
						<tr>
1218
							<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
1234
							<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
1219
						</tr>
1235
						</tr>
1220
						<tr>
1236
						<tr>
1221
							<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= is_numeric($conf['SSH_WAN']) ? $conf['SSH_WAN']:22 ?>" /></td>
1237
							<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= $conf['SSH_WAN'] !== '0' ? $conf['SSH_WAN']:22 ?>" /></td>
1222
							<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= $conf['SSH_ADMIN_FROM'] ?>" /></td>		
1238
							<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= explode('/',$conf['SSH_ADMIN_FROM'])[1] ?>" /></td>		
1223
						</tr>
1239
						</tr>
1224
					</table>
1240
					</table>
1225
					<p>Activer sur tout réseau : 0.0.0.0/0</p>
1241
					<p>Activer sur tout réseau : 0.0.0.0</p>
1226
				</div>
1242
				</div>
1227
				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
1243
				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
1228
				</form>
1244
				</form>
1229
			</div>
1245
			</div>
1230
		</td>
1246
		</td>