prepare("SELECT * FROM branches WHERE id = ? AND is_active = 1"); $stmt->execute([$branch_id]); $branch = $stmt->fetch(); if ($branch && password_verify($pin, $branch['branch_pin_hash'])) { // Login successful $_SESSION['branch_id'] = $branch['id']; $_SESSION['branch_code'] = $branch['branch_code']; $_SESSION['branch_name'] = $branch['branch_name']; $_SESSION['teller_initials'] = $initials; $_SESSION['role'] = 'teller'; // Log login action $log = $pdo->prepare("INSERT INTO audit_log (username, branch_id, action, ip_address, details) VALUES (?, ?, ?, ?, ?)"); $log->execute([$initials, $branch['id'], 'BRANCH_LOGIN', $_SERVER['REMOTE_ADDR'], 'Logged in successfully']); header('Location: scan.php'); exit; } else { $error = 'Invalid branch PIN or inactive branch.'; } } } // Fetch active branches for dropdown $branches = $pdo->query("SELECT * FROM branches WHERE is_active = 1 ORDER BY branch_name ASC")->fetchAll(); ?> AEHPL ID Scanner - Branch Login

AEHPL ID Scanner