-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadUsers.php
38 lines (29 loc) · 911 Bytes
/
loadUsers.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
<?php
session_start();
include 'database/connect.php';
include 'functions.php';
protectAdmin();
$pageNum = (int)$_POST['page'] - 1;
$flag = $_POST['flag'];
$position = $pageNum * $numUsers;
$data = array();
if( $flag == 'valid' ) {
$query = $con->prepare("SELECT user_id, username, email, active, joined FROM users WHERE banned = 0 LIMIT ?, ?");
} else if( $flag == 'banned' ) {
$query = $con->prepare("SELECT user_id, username, email, active, joined FROM users WHERE banned = 1 LIMIT ?, ?");
} else {
exit();
}
$query->bind_param("ii", $position, $numUsers);
$query->execute();
$query->bind_result($user_id, $username, $email, $active, $joined);
while($query->fetch()){
$data['user_id'][] = $user_id;
$data['username'][] = $username;
$data['email'][] = $email;
$data['active'][] = $active;
$data['joined'][] = $joined;
}
$query->close();
echo json_encode($data);
?>