Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <!-- Latest compiled and minified CSS -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
- <!-- Optional theme -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
- <!-- Latest compiled and minified JavaScript -->
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
- <form class="form-inline" method="POST" action="entry.php">
- <div class="form-group">
- <label class="sr-only" for="inputEmail">Email</label>
- <input type="text" name='log' class="form-control" id="inputEmail" placeholder="Имя пользователя">
- </div>
- <div class="form-group">
- <label class="sr-only" for="inputPassword">Пароль</label>
- <input type="password" name='pass' class="form-control" id="inputPassword" placeholder="Пароль">
- </div>
- <div class="checkbox">
- <label><input type="checkbox"> Запомнить</label>
- </div>
- <button type="submit" class="btn btn-primary">Войти</button>
- </form>
- <?php
- //include_once 'connection.php';
- $mysqli = new mysqli("localhost", "root", "", "userlistdb");
- $login = $_POST['log'];
- $q = "SELECT * FROM usertbl WHERE username='".$login."'";
- $result = $mysqli->query($q);
- $myrow = $result->fetch_array();
- if (empty($myrow["username"]))
- {
- exit ("<body><div align='center'><br/><br/><br/>
- <h3>Извините, введённый вами login или пароль неверный." . "<a href='index.php'> <b>Назад</b> </a></h3></div></body>");
- }
- else {
- $hash = $myrow['password'];
- $password = $_POST['pass'];
- $hashing = password_verify($password, $hash);
- //echo $row['id'];
- $userId = $myrow['id'];
- }
- if ($hashing == true) {
- echo "<br><a href='userpage.php?id=$userId'>Мой профиль</a>";
- }
- else {
- exit ("<body><div align='center'><br/><br/><br/>
- <h3>Извините, введённый вами login или пароль неверный." . "<a href='index.php'> <b>Назад</b> </a></h3></div></body>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement