-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanageUsers.php
44 lines (35 loc) · 1016 Bytes
/
manageUsers.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
<?php
include 'header.php';
$db = new PDO('sqlite:database/users.db');
$users = $db->query('SELECT * FROM User WHERE Permission = "reader" OR Permission = "writer"');
$data = $users->fetchAll();
echo '<div id="conteudo">';
echo '<div class="texto">';
echo '<h2>Gestão de Utilizadores</h2><br>';
echo '<table border="1"><tr><th>Nome de Utilizador</th><th>Permissões</th>';
foreach($data as $row)
{
echo '<tr><td>' . $row['Name'] . '</td><td>'. $row['Permission'] .'</th>';
}
echo '</table><br><br>';
echo '
<div>
<form action="changeUserPermissions.php" method="POST">
Utilizador:
<select name="user">';
foreach ($data as $row)
{
echo '<option>' . $row['Name'] . '</option>';
}
echo '
</select><br>
Permissões a atribuir:
<select name="newPermission">
<option> reader </option>
<option> writer </option>
</select><br><br>
<input type="submit" value="Atribuir novas permissões">
</form>';
echo '</div></div>';
?>
</body>