Advertisement
Guest User

Untitled

a guest
May 29th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. session_start();
  3. session_cache_limiter(60);
  4. if (isset($_POST['login'])) {
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7. $rolle = "";
  8.  
  9. require_once ("dbh.php");
  10. $sql = "SELECT * FROM usertabelle WHERE username = '$username'";
  11. $rows = $dbh->query($sql);
  12.  
  13. $success =false;
  14. $error = "";
  15.  
  16. foreach($rows as $row) {
  17. //print_r($row['passwort']. "<br>");
  18. //Fürs Testen die Ausgabe der Daten in der Tabelle
  19. //print_r($row);
  20. if ($row['passwort'] == $password) {
  21. session_start();
  22. $_SESSION['username'] = $row['username'];
  23. $_SESSION['user_id'] = $row['user_id'];
  24. $_SESSION['rolle'] = $row['rolle'];
  25.  
  26. **$success =true;
  27. $success = (string)$success;
  28. header("location:http://localhost/biological_aqua_dreams/galerie/gallerie-admin.php?success=' . $success");**
  29. } else {
  30. $error ="falsches Passwort!";
  31. $success = false;
  32. }
  33. }
  34. if (!$success) {
  35. if ($error == "") {
  36. $error = "Benutzer existiert nicht";
  37. }
  38. header('location:http://localhost/biological_aqua_dreams/galerie/gallerie-admin.php?error=' . $error);
  39. }
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement