Guest User

Untitled

a guest
Dec 5th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php require_once('connect.php'); ?>
  2.  
  3. <form action="#" method="POST">
  4.  
  5. <input type="text" name="username" class="inputLogin" placeholder="Användarnamn">
  6. <input type="password" name="password" class="inputLogin" placeholder="Lösenord">
  7. <input type="submit" name="submit" class="inputLogin button" value="Submit">
  8.  
  9. </form>
  10.  
  11.  
  12.  
  13.  
  14. <?php
  15.  
  16. if(isset($_POST['submit']))
  17. {
  18.  
  19. $inputUsername = $_POST['username'];
  20. $inputPassword = $_POST['password'];
  21.  
  22. $query = mysqli_query("SELECT * FROM kund WHERE Fnamn='$inputUsername' AND pass ='$inputPassword'")
  23. or die("Failed to query database ".mysql_error());
  24.  
  25. $row = mysql_fetch_array($query);
  26. if($row['Fnamn'] == $inputUsername && $row['pass'] == $inputPassword){
  27. echo "login success!";
  28. }
  29. else{
  30. echo "login failed!";
  31. }
  32.  
  33. }
  34.  
  35.  
  36. ?>
Add Comment
Please, Sign In to add comment