Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <?phps
- if($_SERVER["REQUEST_METHOD"] == "post"){
- $login = $_POST["username"];
- $passowrd = $_POST["password"];
- $passwordHash =hash("sha256", $password);
- $con = new PDO("mysql:host=localhost;dbname=chat;","root", "");
- $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $statement = $con->prepare("SELECT * FROM chat.login WHERE username = ? AND passwordHash = ?");
- $statement->bindvalue(1, $login);
- $statement->bindvalue(2, $passwordHash);
- $statement->execute();
- $user = $statement->fetchObject();
- var_dump($user);
- if($user == false)
- {
- echo "fout";
- }
- else
- {
- //header("location: https//www.google.com");
- session_start();
- $_SESSION["user_name"] = $user->username;
- $_SESSION["user_id"] = $user->idlogin;
- Header("location:securepage.php");
- }
- }
- ?>
- <form method="post">
- Username:<br>
- <input type="text" name="firstname"><br>
- password:<br>
- <input type="password" name="lastname">
- <br><br>
- <input type="submit" value="Login">
- </form>
- </body>
- </html>
- <?php //checklogin
- session_start();
- $user = "";
- if(isset($_SESSION["user_id"])){
- $user = $_SESSION["user_name"];
- }
- else
- {
- header("location:oefenindex.php");
- }
- ?>
- <?php //passwordhash
- echo hash("sha256","test");
- ?>
- ?php
- session_start();
- if(isset($_session["username"])){
- echo("welkom".$session["username"])
- }
- else
- {
- header("location:oefenindex.php");
- }
- ?>
- <html> //veiligepagina
- <?php
- include_once "./checklogin.php"
- ?>
- <body>
- welkom <?php echo $user; ?>
- <h2>KIFESH GEHIEMEN JIJ STREST OM DIE DONNIE</h2>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement