<?php
// Connect to the database
require_once('db.php');

// Check if the access code has been submitted
if(isset($_POST['access_code'])) {
    $access_code = $_POST['access_code'];

    // Verify the access code
    $sql = "SELECT code FROM access_codes WHERE code='$access_code'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        // Execute the restricted code here
        header("Location: kycadmin.php");
        exit();
    } else {
        // Display an error message if the access code is incorrect
        echo "Incorrect access code. Access denied.";
    }
} else {
    // Display the form to enter the access code
    echo "<form method='post'>
              <label for='access_code'>Enter Access Code:</label>
              <input type='text' id='access_code' name='access_code'>
              <button type='submit'>Submit</button>
          </form>";
}



$conn->close();
?>
