Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if(!isset($_POST['username']))
  5. $_POST['username'] = '';
  6. if(!isset($_POST['password']))
  7. $_POST['password'] = '';
  8.  
  9. if (isset($_SESSION['ingelogd'])) header("location: index.php");
  10.  
  11.  
  12. $dbhost = "localhost";
  13. $dbuser = "pc4u0fi_username";
  14. $dbpass = "pc4upc4u1";
  15. $dbname = "pc4u0fi_pc4u";
  16. $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  17.  
  18. if ($conn->connect_error) die("Connection failed");
  19.  
  20. if (isset($_POST['submit'])) {
  21.  
  22. $uname = $_POST['username'];
  23. $wwoord = $_POST['password'];
  24.  
  25.  
  26. $query = 'SELECT * FROM Klanten WHERE klant_username = "' . $uname . '" && klant_password = "' . $wwoord . '"';
  27.  
  28. $result = $conn->query($query);
  29. echo $result;
  30.  
  31. if ($result->num_rows == 1) {
  32. $result = $result->fetch_row();
  33. $_SESSION['ingelogd'] = true;
  34. header("location: index.php");
  35. } else {
  36. $msg = "Inloggegevens incorrect.";
  37. }
  38. //$conn->close();
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement