<?php
require_once 'config.php';

function authenticateAdmin($username, $password, $pdo) {
    try {
        $stmt = $pdo->prepare("SELECT * FROM admin WHERE username = :username");
        $stmt->bindParam(':username', $username);
        $stmt->execute();
        $user = $stmt->fetch(PDO::FETCH_ASSOC);

        if ($user) {
            return $user;
        } else {
            return false;
        }
    } catch (PDOException $e) {
        echo "Authentication failed: " . $e->getMessage();
        die();
    }
}
?>
