Add consultation module assets and libraries
This commit is contained in:
39
konsultasi/API/web/getMyPengaturan.php
Normal file
39
konsultasi/API/web/getMyPengaturan.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
include '../../conf/koneksiPDO.php';
|
||||
include '../../conf/function.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$conn = new createCon();
|
||||
$dbh = $conn->connect();
|
||||
|
||||
checkKey('POST', 'token');
|
||||
|
||||
$token = trim($_POST['token']);
|
||||
|
||||
$sql = 'SELECT * FROM mahasiswa WHERE token = :token';
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$stmt->bindParam(':token', $token);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() == 0) {
|
||||
echo getUnauthorizedMessage();
|
||||
exit();
|
||||
}
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$nim = $row['nim'];
|
||||
$nama = $row['nama'];
|
||||
$email = $row['email'];
|
||||
$hp = $row['hp'];
|
||||
}
|
||||
|
||||
echo json_encode(utf8ize(array(
|
||||
'status' => 1,
|
||||
'nim' => $nim,
|
||||
'nama' => $nama,
|
||||
'email' => $email,
|
||||
'hp' => $hp,
|
||||
)));
|
||||
Reference in New Issue
Block a user