Advertisement
failfail

asdasdsad

May 5th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.55 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <!-- Latest compiled and minified CSS -->
  5. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
  6.  
  7. <!-- Optional theme -->
  8. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
  9.  
  10. <!-- Latest compiled and minified JavaScript -->
  11. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
  12.  
  13. <form class="form-inline" method="POST" action="entry.php">
  14.   <div class="form-group">
  15.     <label class="sr-only" for="inputEmail">Email</label>
  16.     <input type="text" name='log' class="form-control" id="inputEmail" placeholder="Имя пользователя">
  17.   </div>
  18.   <div class="form-group">
  19.     <label class="sr-only" for="inputPassword">Пароль</label>
  20.     <input type="password" name='pass' class="form-control" id="inputPassword" placeholder="Пароль">
  21.   </div>
  22.   <div class="checkbox">
  23.     <label><input type="checkbox"> Запомнить</label>
  24.   </div>
  25.  <button type="submit" class="btn btn-primary">Войти</button>
  26. </form>
  27.  
  28. <?php
  29. //include_once 'connection.php';
  30. $mysqli = new mysqli("localhost", "root", "", "userlistdb");
  31. $login = $_POST['log'];
  32. $q = "SELECT * FROM usertbl WHERE username='".$login."'";
  33. $result = $mysqli->query($q);
  34.     $myrow = $result->fetch_array();
  35.    if (empty($myrow["username"]))
  36.     {
  37.     exit ("<body><div align='center'><br/><br/><br/>
  38.    <h3>Извините, введённый вами login или пароль неверный." . "<a href='index.php'> <b>Назад</b> </a></h3></div></body>");
  39.     }
  40.     else {
  41.         $hash = $myrow['password'];
  42.         $password = $_POST['pass'];
  43.         $hashing = password_verify($password, $hash);
  44.             //echo $row['id'];
  45.         $userId = $myrow['id'];      
  46. }  
  47.         if ($hashing == true) {
  48.            
  49.            
  50.        echo "<br><a href='userpage.php?id=$userId'>Мой профиль</a>";
  51.     }
  52.    
  53.    
  54.  
  55.    
  56.  else {
  57.     exit ("<body><div align='center'><br/><br/><br/>
  58.    <h3>Извините, введённый вами login или пароль неверный." . "<a href='index.php'> <b>Назад</b> </a></h3></div></body>");
  59.     }
  60.        
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement