Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('connection.php');
- if(isset($_POST['submit']))
- {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $pass = password_hash($password , PASSWORD_DEFAULT);
- $query = "SELECT * FROM hash WHERE username = '$username'";
- $result = mysqli_query($conn , $query) or die(mysqli_error($conn));
- if (mysqli_num_rows($result) > 0) {
- while ($row = mysqli_fetch_array($result)) {
- $upass = $row['password'];
- }
- if ($upass = $pass) {
- $_SESSION['active'] = $row['id'];
- header("location:welcome.php");
- }
- else {
- echo "<script>alert('error');
- window.location.href= 'index.php';</script>";
- }
- }
- else {
- echo "<script>alert('INVALID USERNAME OR PASSWORD!');
- window.location.href= 'index.php';</script>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment