-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchUser.php
34 lines (27 loc) · 878 Bytes
/
searchUser.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
<?php
session_start();
include 'database/connect.php';
include 'functions.php';
protectAdmin();
$t = $_POST['user'];
$flag = $_POST['flag'];
$text = "%".$t."%";
$data = array();
if( $flag == 'no' ) {
$query = $con->prepare("SELECT user_id, username, email, joined, active FROM users WHERE username LIKE ? AND banned = '0' LIMIT ?");
} else if( $flag == 'yes' ) {
$query = $con->prepare("SELECT user_id, username, email, joined, active FROM users WHERE username LIKE ? AND banned = '1' LIMIT ?");
}
$query->bind_param("ss", $text, $numUsers);
$query->execute();
$query->bind_result($user_id, $user, $mail, $joined, $active);
while($query->fetch()){
$data['user_id'][] = $user_id;
$data['username'][] = $user;
$data['email'][] = $mail;
$data['joined'][] = $joined;
$data['active'][] = $active;
}
$query->close();
echo json_encode($data);
?>