-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgroup1.php
More file actions
62 lines (45 loc) · 1.2 KB
/
group1.php
File metadata and controls
62 lines (45 loc) · 1.2 KB
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
<?php
include("header.php");
if($_SESSION['flag']=="allowed")
{
$sub = $_POST['sub'];
$name = $_POST['name'];
$check_grp = `cat /etc/group | grep $name`;
if($sub=="sub1")
{
if($check_grp)
{
echo '<label class="alert alert-danger"> Group <b>'.$name.'</b> already exists!!</label>';
}
else
{
echo '<ol class="breadcrumb col-xs-offset-1">
<li><a href="index.php">Home</a></li>
<li><a href="system.php">Systems</a></li>
<li class="active">Add Group</li>
</ol> <br>';
$cmd = `sudo groupadd $name`;
echo '<label class="alert alert-success"> Group <b>'.$name.'</b> succesfully Added!!</label>';
}
}
if($sub=="sub2")
{
if($check_grp)
{
echo '<ol class="breadcrumb col-xs-offset-1">
<li><a href="index.php">Home</a></li>
<li><a href="system.php">Systems</a></li>
<li class="active">Delete Group</li>
</ol> <br>';
$x = `sudo groupdel $name`;
echo '<label class="alert alert-success"> Group <b>'.$name.'</b> succesfully Deleted</label>';
}
else
{
echo '<label class="alert alert-danger"> Group <b>'.$name.'</b> does not exist!!</label>';
}
}
}
else
header("location:index.php");
?>