Jump to content


eliasnalevaiko

Member Since 11/03/2016
Offline Last Active 11/03/2016, 01:47
-----

Topics I've Started

Criar Poup up em formulário de login

11/03/2016, 01:13

Olá galera, preciso de uma ajuda, tenho um formulário de login que basicamente utiliza php e html, gostaria que ao invés de ele escrever a mensagem "usuário inexistente", ele colocasse um poup up na tela com essa mensagem, e que o usuário apenas clicasse nessa janela e ele pudesse novamente incluir um usuário e senha, procurei na internet e ap pricnpio toda a documentação que achei na internet não é possível apenas com html, teria que ser um Javascript ou com um div, porém não sei como incluir isso no meu código, segue o mesmo abaixo.

 

obrigado desde já.

 

<?php
    require("funcoes.php");
    
    if(isset($_POST['usuario']) && isset($_POST['senha'])){
        if($_POST['usuario'] == "root" && $_POST['senha'] == "root"){
            header("Location:index.php");
        }
        
        $sql = "SELECT id FROM usuario WHERE usuario = '".$_POST['usuario']."' AND senha = '".$_POST['senha']."'";
        $res = mysql_query($sql);
        $count = mysql_num_rows($res);
        if($count > 0){
            header("Location:index.php");
        }else{
            echo "<pre>";
            print_r("<h1>USUÁRIO INEXISTENTE!</h1>");
            echo "</pre>";
        }
        
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:og="http://ogp.me/ns#">
    <head>
        <title>Formulario de Login</title>
        <style>
            body {
                font-family:Arial;
                font-size:10px;
            }

            table {
                font-family:Arial;
                font-size:11px;
            }

            .titulo {
                margin: 5px;
                background-color:#8FABFF;
            }
            
            .linha {
                margin: 3px;
                background-color:#e6e6e6;
            }
        </style>
    </head>
    <body>
        <form name="login" method="POST" action="login.php">
        <table border="0" bgcolor="#e6e6e6" cellspacing="0" align="center">
            <tr>
                <td colspan="2"> <center><h1> Controle de Livros - v0.0.1 </h1></center></td>
            </tr>
            <tr>
            <td>
                <img src="imagens/indice.jpg" alt="imagem" width="60px">
            </td>
            <td>
                <table border="0" width="300px" bgcolor="#FFFFFF">
                    <tr>
                        <td class="titulo"> Usuario </td>
                        <td> <input type="text" size="30" maxlength="30" name="usuario"> </td>
                    </tr>
                    <tr>
                        <td class="titulo"> Senha </td>
                        <td> <input type="password" size="30" maxlength="30" name="senha">  </td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="submit" value="Enviar"></td>
                    </tr>
                </table>
            <td>
            </tr>
        
        </form>
    </body>
--------------------


IPB Skin By Virteq