Advertisement
Guest User

index.php

a guest
Apr 11th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2.    
  3.     $error = "";
  4.        
  5.         if(isset($_POST['submit'])) {
  6.        
  7.             $query = mysqli_query($this->db,"SELECT * FROM users
  8.                 WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'");
  9.            
  10.             if(mysqli_num_rows($query) == 0) {
  11.                 $error = "Username or Passowrd is incorrect.";
  12.             } else {
  13.                 $fetch = mysqli_fetch_array($query);
  14.                 $_SESSION['user'] = $fetch['id'];
  15.                 $error = "You are now logged in.";
  16.             }
  17.            
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement