check this code:
<?php
require 'C:\Windows\System32\vendor\autoload.php';
if (isset( $_POST['submit'] ) && isset( $_POST['username'] ) && isset( $_POST['password'] ) ) {
    session_start();
    $username = ( $_POST['username'] );
    $password = ( $_POST['password'] );
    $hashpass = "";
    $_SESSION['username']=$username;
    $return = array();
    $con = new MongoDB\Client( 'mongodb+srv://Admin:Pass123@cluster0.ivtq9gb.mongodb.net/?retryWrites=true&w=majority' );
    // Select Database
    if ( $con ) {
        $db = $con->AdminDatabase;
        // Select Collection
        $collection = $db->Admin;
        $cursor = $collection->find( array( 'username' => $username ) );
        foreach ( $cursor as $row ) {
            $hashpass = $row["password"];
            $block_time = $row["block_time"];
        }
        
        // Check if user has failed login attempts
        if (isset($_SESSION['failed_login_attempts']) && is_numeric($_SESSION['failed_login_attempts']) && $_SESSION['failed_login_attempts'] >= 3) {
            // Check if user is currently blocked
            if (time() < $block_time) {
                // User is still blocked, show error message
                echo "<script>alert('Your account is currently blocked. Please try again in 1 hour.');document.location='AdminLogin.php'</script>";
                exit;
            } else {
                // User is no longer blocked, reset failed login attempts and continue with login process
                unset($_SESSION['failed_login_attempts']);
                unset($_SESSION['blocked_until']);
            }
        }
        
        if ( password_verify($password,$hashpass) ) {
            
            header( 'Location:AdminHome.php' );
            exit;
        } else {
            // Increment failed login attempts
            if (!isset($_SESSION['failed_ login_attempts'])) {
                $_SESSION['failed_login_attempts'] = 0;
            }
            $_SESSION['failed_login_attempts']++;
            
            // If user has reached 3 failed login attempts, block their account for 1 hour
            if ($_SESSION['failed_login_attempts'] >= 3) {
                $_SESSION['blocked_until'] = time() + 3600; // block for 1 hour
                $collection->updateOne(
                    array( 'username' => $username ),array( '$set' => array( 'block_time' => $_SESSION['blocked_until'], 'status' => "blocked" ) )
                );
                }
                    echo "<script>alert('Your UserName or Password is Incorrect');document.location='AdminLogin.php'</script>";
                        
                    }
                } else {
                
                    die( "Mongo DB not connected" );
                }
                }
                ?>
