HTML gerado ao logar com usuário ou senha inválidos, utilizando o if
<html lang="en">
    <head></head>
    <body>
        <div class="container">
            <h1></h1>
            <table class="table"></table>
            <h1></h1>
            <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/login/autenticar"></form>
            <h1></h1>
            <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/usuarios/novo"></form>
        </div>
    </body>
</html>
HTML gerado com o código acima sem if
Ao atualizar a página:
    <html lang="en">
        <head></head>
        <body>
            <div class="container">
                         p1: 
                <p class="alert alert-danger"></p>
                    p2: 
                <p class="alert alert-danger"></p>
                <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"></div>
                <p></p>
                <h1></h1>
                <table class="table"></table>
                <h1></h1>
                <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/login/autenticar"></form>
                <h1></h1>
                <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/usuarios/novo"></form>
            </div>
        </body>
    </html>
Após efetuar login com usuário ou senhas inválidas.
    <html lang="en">
        <head></head>
        <body>
            <div class="container">
                         p1: 
                <p class="alert alert-danger"></p>
                    p2: 
                <p class="alert alert-danger"></p>
                <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"></div>
                <p>
                </p>
                <h1></h1>
                <table class="table"></table>
                <h1></h1>
                <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/login/autenticar"></form>
                <h1></h1>
                <form accept-charset="utf-8" method="post" action="http://localhost/mercado/index.php/usuarios/novo"></form>
            </div>
        </body>
    </html>
Mesmo com os 
s sendo mostrados sem if, a mensagem se "usuário ou senha inválidos" não aparece. Será que o problema não está a nível de session? Abraço.