Nerviie

Index

May 26th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.40 KB | None | 0 0
  1. <?php
  2.     session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7.     <title>Reis</title>
  8.     <meta charset="utf-8">
  9.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  10.     <style type="text/css">
  11.         body{
  12.             background-color: white;
  13.             font-family:
  14.         }
  15.         #nav{
  16.             opacity: .8;
  17.             padding-top: 50px;
  18.         }
  19.         #nav:hover {
  20.             opacity: 1.0;
  21.         }
  22.     </style>
  23. </head>
  24. <body>
  25.     <?php
  26.        
  27.         $bd_host="localhost";
  28.         $bd_user="root";
  29.         $bd_password="";
  30.         $bd_database="website";
  31.  
  32.  
  33.         $ms = new mysqli($bd_host,$bd_user,$bd_password,$bd_database);
  34.  
  35.         $nome=$email=$tipo=$msg1=$num="";
  36.  
  37.         if ($ms->connect_error) {
  38.             die('Erro: ('. $ms->connect_errno .') '. $ms->connect_error);
  39.         }
  40.  
  41.         if(isset($_POST["login"])){
  42.             if($_POST["email"]!="" && $_POST["pass"]!=""){
  43.                 $qr = "Select idlogin,nome,mail,tipo from login where mail=? and password=?";      
  44.                 $ordem = $ms->prepare($qr);            
  45.                 $ordem->bind_param('ss', $_POST["email"],$_POST["pass"]);
  46.                 $ordem->execute();
  47.                 $ordem->bind_result($num , $nome, $email , $tipo);
  48.                 if($ordem->fetch()){
  49.                     $_SESSION["nid"]=session_id();
  50.                     $_SESSION["num"]=$num;
  51.                     $_SESSION["nome"]=$nome;
  52.                     $_SESSION["email"]=$email;
  53.                     $_SESSION["tipo"]=$tipo;
  54.                     $msg1='<h3 class="ok">Bem Vindo!</h3>';
  55.                 }
  56.                 else{
  57.                     $msg1='<h3 class="alert">Erro, Dados de acesso errados!</h3>';
  58.                 }  
  59.                 $ordem->close();
  60.             }  
  61.             else{
  62.                 $msg1='<h3 class="alert">Digite os seus dados de acesso</h3>';
  63.             }
  64.         }
  65.  
  66.         if(isset($_POST["logout"])){
  67.             session_unset();
  68.             session_destroy();
  69.         }
  70.  
  71.         include "cabecalho.php";
  72.  
  73.         echo "$msg1";
  74.     ?>  
  75.  
  76.     <?php
  77.  
  78.     if(isset($_GET['op']))
  79.     {
  80.         include($_GET['op'] . '.php');
  81.     }
  82.     else
  83.         include('default.php');
  84.  
  85. ?>
  86.  
  87. </body>
  88. </html>
Add Comment
Please, Sign In to add comment