$passwords_manager->validate impossble [duplicate]

I have a problem for a few days now, I can’t check the phpbb3 password stored in my database (HASH) but I really can’t do it after a sleepless night, I turns towards you.

I created a phpbb3 forum but my site is not just a forum so on my login page I need to check the password but impossible

here is my PHP code which serves as an API for calls to the database

my file tree is

CSS
Forum(phpbb3)
Image
JS
translation
Video
Dowload.html
Forum.html
Login.html
SingUp.html
Status.html
api.php

<?php
header("Content-Type: application/json");

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './Forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx); 




$servername = "localhost";
$dbUsername = "root";
$dbPassword = "";  // Renommé pour éviter toute confusion
$dbname = "phpbb3";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $dbUsername, $dbPassword);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    http_response_code(500);
    echo json_encode(["message" => "Connection failed: " . $e->getMessage()]);
    exit();
}

$method = $_SERVER['REQUEST_METHOD'];
$input = json_decode(file_get_contents('php://input'), true);

switch ($method) {
    case 'POST':
        if (isset($input['username']) && isset($input['password'])) {
            loginUser($input['username'], $input['password']);
        } else {
            http_response_code(400);
            echo json_encode(["message" => "Username and password are required"]);
        }
        break;
    case 'OPTIONS':
        http_response_code(200);
        exit();
    default:
        http_response_code(405);
        echo json_encode(["message" => "Method not allowed"]);
        break;
}

function loginUser($username, $password) {
    global $conn;

    $phpbb_container = phpbbdicontainer::get_instance();
    // Obtenez le gestionnaire de mots de passe
    $passwords_manager = $phpbb_container->get('passwords.manager');

    // Préparer la requête pour récupérer le hash du mot de passe pour l'utilisateur donné
    $stmt = $conn->prepare("SELECT username, user_password FROM phpbb_users WHERE username = :username");
    $stmt->bindParam(':username', $username);
    $stmt->execute();
    $result = $stmt->fetch(PDO::FETCH_ASSOC);

    // Vérifier si un résultat a été trouvé
    if ($result) {
        // Afficher le hash du mot de passe
        echo json_encode($result['user_password']);

        // Vérifier si le mot de passe fourni correspond au hash dans la base de données
        if ($passwords_manager->validate($password, $result['user_password'])) {
            echo json_encode(["message" => "Connection reussi: "]);
            exit();
        } else {
            echo json_encode(["message" => "Nom d'utilisateur ou mot de passe incorrect.", "status" => "error"]);
        }
    } else {
        echo json_encode(["message" => "Nom d'utilisateur ou mot de passe incorrect.", "status" => "error"]);
    }
}
?>

//I can't use
$phpbb_container = phpbbdicontainer::get_instance();
$passwords_manager = $phpbb_container->get('passwords.manager');
if ($passwords_manager->validate($password, $result['user_password']))

here is the answer it gives me

General Error

/* <![CDATA[ */

  • { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: “Lucida Grande “, Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } #wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } .panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } #errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } #errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em “Lucida Grande “, Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; }
    /* ]]> */
    Return to index page

    General Error

    Illegal use of $_SERVER. You must use the request class to access input data. Found in C:wamp64www????api.php on line 26. This error message was generated by deactivated_super_global.

    Please notify the board administrator or webmaster: [email protected]

    Powered by phpBB® Forum Software © phpBB Limited