Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- session_cache_limiter(60);
- if (isset($_POST['login'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $rolle = "";
- require_once ("dbh.php");
- $sql = "SELECT * FROM usertabelle WHERE username = '$username'";
- $rows = $dbh->query($sql);
- $success =false;
- $error = "";
- foreach($rows as $row) {
- //print_r($row['passwort']. "<br>");
- //Fürs Testen die Ausgabe der Daten in der Tabelle
- //print_r($row);
- if ($row['passwort'] == $password) {
- session_start();
- $_SESSION['username'] = $row['username'];
- $_SESSION['user_id'] = $row['user_id'];
- $_SESSION['rolle'] = $row['rolle'];
- **$success =true;
- $success = (string)$success;
- header("location:http://localhost/biological_aqua_dreams/galerie/gallerie-admin.php?success=' . $success");**
- } else {
- $error ="falsches Passwort!";
- $success = false;
- }
- }
- if (!$success) {
- if ($error == "") {
- $error = "Benutzer existiert nicht";
- }
- header('location:http://localhost/biological_aqua_dreams/galerie/gallerie-admin.php?error=' . $error);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement