Untitled
unknown
plain_text
2 years ago
900 B
6
Indexable
<?php
// Include file DBOperation.php
require_once '../include/DBOperation.php';
// Response array
$response = array();
$item = array();
// Check for POST request
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Check if all required fields are set
if (isset($_POST['npm'])) {
$db = new DBOperation();
$login = $db->loginMhs($_POST['npm']);
while ($data = mysqli_fetch_array($login)) {
$item[] = array(
'username' => $data["username"],
'PASSWORD' => $data["PASSWORD"],
'email' => $data["email"]
);
}
$response['data'] = $item;
} else {
// Failed to add mahasiswa to database
$response['message'] = "Parameter POST tidak lengkap";
}
} else {
$response['message'] = "Request tidak valid";
}
echo json_encode($response);
Editor is loading...