Guest User

Untitled

a guest
Jul 10th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.  require_once 'dbconnect.php';
  3.  $error = false;
  4.  
  5.  if(isset($_POST['username']) && isset($_POST['password']) ) {
  6.  
  7.   $username = trim($_POST['username']);
  8.   $username = strip_tags($username);
  9.   $username = htmlspecialchars($username);
  10.  
  11.   $pass = trim($_POST['pass']);
  12.   $pass = strip_tags($pass);
  13.   $pass = htmlspecialchars($pass);
  14.  
  15.  
  16.   if(empty($username)){
  17.    $error = true;
  18.    $emailError = "Please enter username.";
  19.   }
  20.  
  21.   if(empty($pass)){
  22.    $error = true;
  23.    $passError = "Please enter your password.";
  24.   }
  25.  
  26.   if (!$error) {
  27.      $query = "SELECT * FROM `users` WHERE username='$username'
  28. and password='$pass'";
  29.     $result = mysqli_query($con,$query);
  30.     $rows = mysqli_num_rows($result);
  31.         if($rows==1){
  32.             if ($rows["premium"] == 1){
  33.                 $premium = "true";
  34.             } else {
  35.                 $premium = "false";
  36.             }
  37.         die('{"success":"true", "username":"'$username'", "premium":"'$premium'"}');
  38.          }else{
  39.     die('{"success":"false"}')
  40.     }
  41.     }else{
  42.   }
  43.  }
Add Comment
Please, Sign In to add comment