daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Jan 28th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php session_start();?>
  2. <div class="container">
  3.     <div class='row'>
  4.         <div class='col-md-6'>
  5.            
  6.             <form action="home" method="post"  class='form-horizontal customform'>
  7.          
  8.                                
  9.                
  10.                 <div class='form-group formbody'>
  11.                                    
  12.                                 <label class="control-label col-xs-3" for="Name">Login:</label>
  13.                         <div class="col-xs-9">
  14.                         <input type="text" name="login" class="form-control" id="login" placeholder="login">
  15.                         </div>
  16.  
  17.                         <label class="control-label col-xs-3" for="Pesel">Hasło:</label>
  18.                         <div class="col-xs-9">
  19.                         <input type="text" name="password" class="form-control" id="password" placeholder="hasło">
  20.                         </div>
  21.                                
  22.                 </div>
  23.                
  24.                 <div class="form-group">        
  25.                     <div class="col-xs-12">
  26.                         <button type="submit" value="submit" name="submit" id="submit" class="btn btn-default">Zaloguj</button>
  27.                                 </div>
  28.                                 </div>
  29.                         </form>
  30.         </div>
  31.     </div>
  32. </div>
  33.  
  34. <?php
  35.  
  36. $servername = "localhost";
  37. $username = "root";
  38. $password = "";
  39. $dbname = "szpital";
  40.  
  41. $pdo = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  42. $sql = "SELECT * FROM users WHERE login = :login";
  43.  
  44.    
  45.    
  46.  
  47.  
  48.  
  49. if(!empty(['login']) && !empty(['password']) ) {
  50.     echo "Wprowadź login i hasło";
  51. } else {
  52.  
  53. $query = $pdo->prepare($sql);
  54. $query->execute(array(':login' => $login));
  55.  $result = $query->fetch(PDO::FETCH_ASSOC);
  56.  $login = $_POST['login'];
  57.  $pass = $_POST['password'];  
  58.  foreach($result as $row) {
  59.  $password_crypt = $row['password'];
  60.  print_r($password_crypt);
  61.  echo '<br>';
  62.  print_r($pass);
  63.  
  64.  }
  65. echo '<br>';
  66.  
  67. if ($password_crypt === $pass) {
  68.     echo "Zweryfikowano pozytywnie";
  69.      $_SESSION[ 'allah' ] = true;
  70.      header("location: /szpital/home");
  71.      die();
  72. } else {
  73.     print_r("Unlucky");
  74. }
  75. }
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