Advertisement
willamepcosta

index.php

Sep 22nd, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2. require_once 'classes/usuario.php';
  3. $u = new Usuario;
  4. ?>
  5.  
  6. <!DOCTYPE html>
  7. <html lang="pt-br">
  8. <head>
  9.     <meta charset="utf-8">
  10.     <title>BODE DA SORTE - Sorteios Entre Amigos</title>
  11.     <link rel="stylesheet" href="css/estilo.css">
  12. </head>
  13. <body style="position: relative; top: 35px;">
  14.  
  15. <SPAN style="position: absolute; top: -160px; left: 550px">
  16. <IMG SRC="imagens/logo.png" >
  17. </SPAN>
  18.  
  19.         <div id="corpo-form">
  20.         <h1>Entrar no Sistema</h1>
  21.     <form method="post">
  22.         <input type="email" placeholder="Usuário" name="email">
  23.         <img src="imagens/user.png" width="48" height="48" id="img_user">
  24.         <input type="password" placeholder="Senha" name="senha">
  25.         <img src="imagens/pass.png" width="48" height="48" id="img_pass">
  26.         <input type="submit" value="Acessar">
  27.     </form>
  28. </div>
  29. <?php
  30. if(isset($_POST['email']))
  31. {
  32.     $email = addslashes($_POST['email']);
  33.     $senha = addslashes($_POST['senha']);
  34.     if(!empty($email) && !empty($senha))
  35.     {
  36.         $u->conectar("projeto_gestao","localhost","root","");
  37.         if($u->msgErro =="")
  38.         {
  39.         if($u->logar($email,$senha))
  40.         {
  41.             header("location: area_restrita.php");
  42.         }
  43.         else
  44.         {
  45.             ?>
  46.             <div class="msg-erro">
  47.             Email e/ou senha estão incorretos!
  48.             </div>
  49.             <?php
  50.         }
  51.     }
  52.     else
  53.         {
  54.             ?>
  55.             <div class="msg-erro">
  56.             <?php echo "Erro: ".$u->msgErro; ?>
  57.             </div>
  58.             <?php
  59.         }
  60.     }else
  61.     {
  62.         ?>
  63.         <div class="msg-erro">
  64.         Preencha todos os campos
  65.         </div>
  66.         <?php
  67.     }
  68. }
  69. ?>
  70.  
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement