A modal bootstrap appears before HTML

Asked

Viewed 111 times

0

I have a page from which after 03 attempts access to page is blocked. But I would like that if the page is blocked, when trying to access, to appear a modal bootstrap with a message:

Blocked page. Please contact the administrator for request the release of.

And that this modal was activated within this condition in PHP:

if($visualizarVerificar->Bloqueado == "S"){
        // Entraria aqui a ativação do modal Boostrap
        echo "<script>window.location.href='index.php';</script>";
        exit;
}

That’s possible?

1 answer

1


Library

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Modal HTML

<div id="myModal" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Página bloqueada</h4>
            </div>
            <div class="modal-body">
                <p>Favor entrar em contato com o administrador para solicitar o desbloqueio.</p>
                <p class="text-warning"><small>contato</small></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
            </div>
        </div>
    </div>
</div>

Script

if($visualizarVerificar->Bloqueado == "S"){
    echo "<script>
        $(\"#myModal\").modal('show');
    </script>"; 

    exit();
}

The script after Modal HTML

Testing - Blocked Page

Browser other questions tagged

You are not signed in. Login or sign up in order to post.