-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
71 lines (55 loc) · 1.75 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<head>
<title>Cisco Panel By Hamed Ap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/style.css" type="text/css">
</head>
<body style="background-color:rgba(0,0,0,1.00);color:white">
<h1 style="font-size:25px;text-align:center;color:yellow;">Cisco Panel By Hamed Ap</h1>
<div class="center">
<hr>
<form method="POST" action="/">
<input name="username" type="text" placeholder="Username">
<br><input name="password" type="text" placeholder="Password">
<br><input type="submit" name="useradd" value="Add User" style="background-color: green;">
</form>
<hr>
<form method="POST" action="/">
<input name="delusername" type="text" placeholder="Username">
<input type="submit" name="deluser" value="Remove User" style="background-color:red;">
</form>
<hr>
<h1 style="font-size:25px;text-align:center;color:yellow;">User List : </h1>
<table style="width:100%">
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (isset($_POST['useradd'])){
exec('bash adduser.sh '.$_POST['username']." ". $_POST['password'], $out);
echo "user added ! ";
}
if (isset($_POST['deluser'])){
$lines = file("/etc/ocserv/passwd", FILE_IGNORE_NEW_LINES);
foreach ( $lines as $line) {
$variable = substr($line, 0, strpos($line, ":"));
if ( $variable == $_POST['delusername']) {
}else{
$newline[] = $line;
}
}
file_put_contents('/etc/ocserv/passwd', implode(PHP_EOL, $newline));
echo " removed ";
}
$lines = file("/etc/ocserv/passwd", FILE_IGNORE_NEW_LINES);
foreach ( $lines as $line) {
$variable = substr($line, 0, strpos($line, ":"));
echo "<tr>
<th>".$variable."</th>
</tr>";
}
?>
</table>
</div>
</body></html>