<?php

require_once "config.php";

header('Content-Type: application/json');
$method = $_SERVER['REQUEST_METHOD'];

switch ($method) {
    case 'GET':
    $cemail = $_GET["cemail"];
    $cpassword = $_GET["cpassword"];
    $query = $conn->query("SELECT * FROM tbuservalidasi WHERE username = '$cemail' AND password = '$cpassword'");
    $result = $query->fetch_assoc();
    echo json_encode($result);
    break;
     

    default:

    // Invalid method
    http_response_code(405);
    echo json_encode(['error' => 'Method not allowed']);
    break;
}
mysqli_close($conn);
?>