Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $verbindung = mysql_connect("entfernt", "entfernt", "entfernt")
- or die ("Fehler im System");
- mysql_select_db("jericho") or die ("Verbindung zur Datenbank war nicht erfolgreich");
- session_start();
- $output = 0;
- if(!isset($_SESSION["username"]) and !isset($_GET["page"])) {
- $output = 0;
- }
- if($_GET["page"] == "log") {
- $user = strtolower($_POST["user"]);
- $password = md5($_POST["password"]);
- $user_exist = ("SELECT * FROM userdaten WHERE Username = '".$user."' AND Passwort = '".$password."'");
- if($user_exist === true) {
- $_SESSION["username"] = $user;
- $output = 1;
- } else {
- $output = 2;
- }
- }
- ?>
- <html>
- <head>
- <meta name='viewport' content='width=device-width, initial-scale=1' />
- <meta charset="utf-8" />
- <title>Login</title>
- <?php
- if($output === 1) {
- ?>
- <meta http-equiv="refresh" content="3; URL=hash.php" />
- <?php
- }
- ?>
- </head>
- <body>
- <?php
- if ($output === 0) {
- ?>
- Bitte logge dich ein: <br>
- <form method="post"> action="?page=log"
- Username: <input type="text" name="user" /> <br>
- Passwort: <input type="password" name="password" /> <br>
- <input type="submit" value="Einloggen" /> <br>
- Noch kein Account? <a href='register.php'>Hier registrieren!</a>
- </form>
- <?php
- }
- if ($ouput === 1) {
- ?>
- Login erfolgreich! Du wirst sofort weiter geleitet
- <?php
- }
- if ($output === 2) {
- ?>
- Passwort oder Username falsch, bitte probier es nochmal! <br>
- <a href='index.php'>Zurück </a>
- <?php
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement