Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- section.container{
- border: 1px solid black;
- padding-left: 383px;
- background-color: rgba(142, 51, 51, 0.32);
- }
- body {
- background-color: #484646;
- color: white;
- }
- </style>
- </head>
- <body>
- <?php
- //checken of er op de sumbit button is geklikt
- if($_SERVER["REQUEST_METHOD"] == "POST"){
- $login = $_POST["login"]; //
- $password = $_POST["password"];
- $passwordHash = hash("sha256", $password);
- $con = new PDO("mysql:host=localhost;dbname=bluetube;", "root", ""); // connectie met database
- $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $statement = $con->prepare("SELECT * FROM hashing WHERE login = ? AND passwordHash = ?"); // query
- $statement->bindValue(1, $login); //waarde toevoegen bij ?
- $statement->bindValue(2, $passwordHash); // waarde toevoegen bij ?
- $statement->execute(); // de query uitvoeren
- $user = $statement->fetchObject(); //gooit data uit database in $user
- if($user === false) { // check of de gegevens van $user fout is
- echo "<h1>FOUT!!!</h1>";
- }else{
- Header("location: http://www.google.nl");
- }
- }
- ?>
- <section class="container">
- <div class="login">
- <h1>Login to Web App</h1>
- <form method="post">
- <p><input type="text" name="login" value="" placeholder="Username or Email"></p>
- <p><input type="password" name="password" value="" placeholder="Password"></p>
- <p class="remember_me">
- <label>
- <input type="checkbox" name="remember_me" id="remember_me">
- Remember me on this computer
- </label>
- </p>
- <p class="submit"><input type="submit" name="commit" value="Login"></p>
- </form>
- </div>
- </section>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement