<?php
header('Content-Type: application/json');
include '../connection.php';

$email = $_POST['email'];
$otp = $_POST['otp'];

$query = "SELECT * FROM tblcred WHERE LOWER(email)=LOWER('$email') AND otp_code='$otp'";
$result = mysqli_query($conn, $query);

if (mysqli_num_rows($result) > 0) {
    echo json_encode(['success' => true, 'message' => 'OTP verified']);
} else {
    echo json_encode(['success' => false, 'message' => 'Invalid OTP']);
}
?>
