Marijn button #99
@@ -58,6 +58,10 @@
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.usertitle {
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.usertable {
|
.usertable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,33 @@ function select20GroupsByStatusFromN($db, $n, $status) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function search20GroupsFromNByStatus($db, $n, $keyword, $status) {
|
||||||
|
$q = $db->prepare("
|
||||||
|
SELECT
|
||||||
|
`groupID`,
|
||||||
|
`name`,
|
||||||
|
`status`,
|
||||||
|
`description`
|
||||||
|
FROM
|
||||||
|
`group_page`
|
||||||
|
WHERE
|
||||||
|
`name` LIKE :keyword AND
|
||||||
|
FIND_IN_SET (`status`, :statuses)
|
||||||
|
ORDER BY
|
||||||
|
`name`
|
||||||
|
LIMIT
|
||||||
|
:n, 20
|
||||||
|
");
|
||||||
|
|
||||||
|
$keyword = "%$keyword%";
|
||||||
|
$q->bindParam(':keyword', $keyword);
|
||||||
|
$q->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
|
$statuses = implode(',', $status);
|
||||||
|
$q->bindParam(':statuses', $statuses);
|
||||||
|
$q->execute();
|
||||||
|
return $q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -68,5 +68,18 @@ function search20UsersFromNByStatus($db, $n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeUserStatusByID($db, $id, $status) {
|
||||||
|
$q = $db->query("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`role` = $status
|
||||||
|
WHERE
|
||||||
|
`userID` = $id
|
||||||
|
");
|
||||||
|
|
||||||
|
return $q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -29,7 +29,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php include_once("../queries/user.php"); ?>
|
<?php
|
||||||
|
include_once("../queries/user.php");
|
||||||
|
include_once("../queries/group_page.php");
|
||||||
|
?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -57,6 +60,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$groupstatus = $_POST["groupstatus"];
|
$groupstatus = $_POST["groupstatus"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
|
||||||
|
changeUserStatusByID($db, $_POST["userID"], $_POST["actions"]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +159,7 @@ function test_input($data) {
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="admin-users">
|
<div class="admin-users">
|
||||||
<h2>Users:</h2>
|
<h2 class="usertitle">Users:</h2>
|
||||||
|
|
||||||
<div class="admin-userpage">
|
<div class="admin-userpage">
|
||||||
<input type="submit" name="prev" value="prev">
|
<input type="submit" name="prev" value="prev">
|
||||||
@@ -174,44 +180,84 @@ function test_input($data) {
|
|||||||
|
|
||||||
<!-- Table construction via php PDO. -->
|
<!-- Table construction via php PDO. -->
|
||||||
<?php
|
<?php
|
||||||
$q = search20UsersFromNByStatus($db, $listnr, $search, $status);
|
if ($pagetype == 'user') {
|
||||||
|
$q = search20UsersFromNByStatus($db, $listnr, $search, $status);
|
||||||
|
|
||||||
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$userID = $user['userID'];
|
$userID = $user['userID'];
|
||||||
$username = $user['username'];
|
$username = $user['username'];
|
||||||
$role = $user['role'];
|
$role = $user['role'];
|
||||||
$bancomment = $user['bancomment'];
|
$bancomment = $user['bancomment'];
|
||||||
$thispage = htmlspecialchars($_SERVER['PHP_SELF']);
|
$thispage = htmlspecialchars($_SERVER['PHP_SELF']);
|
||||||
|
|
||||||
echo("
|
echo("
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type='checkbox'
|
<td><input type='checkbox'
|
||||||
name='checkbox-user[]'
|
name='checkbox-user[]'
|
||||||
value='$userID'>
|
value='$userID'>
|
||||||
</td>
|
</td>
|
||||||
<td>$username</td>
|
<td>$username</td>
|
||||||
<td>$role</td>
|
<td>$role</td>
|
||||||
<td>$bancomment</td>
|
<td>$bancomment</td>
|
||||||
<td>
|
<td>
|
||||||
<form class='admin-useraction'
|
<form class='admin-useraction'
|
||||||
action='$thispage'
|
action='$thispage'
|
||||||
method='post'>
|
method='post'>
|
||||||
<select class='action' name='actions'>
|
<select class='action' name='actions'>
|
||||||
<option value='freeze'>Freeze</option>
|
<option value='2'>Freeze</option>
|
||||||
<option value='ban'>Ban</option>
|
<option value='3'>Ban</option>
|
||||||
<option value='restore'>Restore</option>
|
<option value='1'>Restore</option>
|
||||||
</select>
|
</select>
|
||||||
<input type='hidden' name='userID' value='$userID'>
|
<input type='hidden' name='userID' value='$userID'>
|
||||||
<input type='submit' value='Confirm'>
|
<input type='submit' value='Confirm'>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
");
|
");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$q = search20GroupsFromNByStatus($db, $listnr, $search, $groupstatus);
|
||||||
|
|
||||||
|
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$groupID = $group['groupID'];
|
||||||
|
$name = $group['name'];
|
||||||
|
$role = $group['status'];
|
||||||
|
$description = $group['description'];
|
||||||
|
$thispage = htmlspecialchars($_SERVER['PHP_SELF']);
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<tr>
|
||||||
|
<td><input type='checkbox'
|
||||||
|
name='checkbox-group[]'
|
||||||
|
value='$groupID'>
|
||||||
|
</td>
|
||||||
|
<td>$name</td>
|
||||||
|
<td>$role</td>
|
||||||
|
<td>$description</td>
|
||||||
|
<td>
|
||||||
|
<form class='admin-groupaction'
|
||||||
|
action='$thispage'
|
||||||
|
method='post'>
|
||||||
|
<select class='action' name='actions'>
|
||||||
|
<option value='hide'>Hide</option>
|
||||||
|
<option value='public'>Public</option>
|
||||||
|
<option value='restore'>Restore</option>
|
||||||
|
</select>
|
||||||
|
<input type='hidden' name='groupID' value='$groupID'>
|
||||||
|
<input type='submit' value='Confirm'>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<pre>
|
||||||
|
<?php print_r($_POST); ?>
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user