SHARE
TWEET

Untitled

a guest Jan 25th, 2016 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7.     <html lang="en"><head>
  8.            
  9.         <meta charset="utf-8">
  10.     <title>Login</title>
  11.     <script src="bootstrap/js/jquery.js"></script>
  12.     <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  13.     <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
  14.     <script src="bootstrap/js/bootstrap.min.js"></script>
  15.        
  16.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  17.         <meta name="viewport" content="width=device-width, initial-scale=1">
  18.         <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  19.         <link rel="icon" href="../../favicon.ico">
  20.  
  21.         <!-- Custom styles for this template -->
  22.         <link href="bootstrap/css/estilos.css" rel="stylesheet">
  23.  
  24.     </head>
  25.  
  26.     <body>
  27.  
  28.       <div class="container" style="margin: 75px auto; width:300px; height:300px;">
  29.  
  30.         <form class="form-signin" action="#" method="post">
  31.           <h2 class="form-signin-heading">Please Log in</h2>
  32.           <input id="inputEmail" class="form-control marged_inputs" placeholder="User" required="" autofocus="" type="text" name="name_login">
  33.           <input id="inputPassword" class="form-control marged_inputs" placeholder="Password" required="" type="password" name="pass_login">
  34.           <button class="btn btn-lg btn-primary btn-block" type="submit" name="send_login">Log in</button>
  35.         </form>
  36.             <?php
  37.             session_start();
  38.             $login = filter_input(INPUT_POST,"send_login");
  39.             //$conector_bbdd = new mysqli('servidor', 'usuario', 'contraseƱa','nombre_base_datos');
  40.             $conector_bbdd = new mysqli('localhost', 'root', 'raspberry','user1');
  41.             if(isset($login)){
  42.                 $name = filter_input(INPUT_POST,"name_login");
  43.                 $pass = filter_input(INPUT_POST,"pass_login");
  44.                 $name_seguro = htmlspecialchars($name);
  45.                 $pass_segura = htmlspecialchars($pass);
  46.                 $pass_segura_cifrada = hash('md5',$pass_segura);
  47.                 $consulta = "SELECT user,password FROM login WHERE user ='".$name_seguro."' AND password ='".$pass_segura_cifrada."'";
  48.                 $resultado = $conector_bbdd->query($consulta);
  49.                 if($resultado->num_rows == 1){
  50.                     $rows = array();
  51.                     while($row = $resultado->fetch_array(MYSQLI_NUM))
  52.                     {
  53.                         $rows[] = $row;
  54.                     }
  55.                     $_SESSION["username"] = $rows[0];
  56.                     header("Location: sensor.php");
  57.                 }else{
  58.                     echo '<div class="alert alert-danger" role="alert">El usuario y la contraseƱa no coinciden</div>';
  59.                 }
  60.             }
  61.             $conector_bbdd->close();
  62.           ?>
  63.          
  64.  
  65.       </div> <!-- /container -->
  66.  
  67.  
  68.       <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  69.       <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  70.  
  71.  
  72.   </body>
  73. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top