Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Login Page -->
- <html>
- <head>
- <title>Welcome</title>
- </head>
- <body>
- <form action="project.php" method="POST">
- Username: <input type="text" name="username"/>
- Password: <input type="password" name="password"/>
- <input type="submit" value="Submit"/>
- </form>
- </body>
- </html>
- index.php 1,19 All
- <!-- Login Attempt Page -->
- <?php
- $username = $_POST['username'];
- $pass = $_POST['password'];
- $hash = password_hash($pass, PASSWORD_DEFAULT);
- if ($username == 'alex' && $pass == 'genesis') {
- echo "You have successfully logged in!";
- $path = $_SERVER['DOCUMENT_ROOT'] . '/project/credentials/hashed_password.txt';
- $f = fopen($path, 'w');
- fwrite($f, $hash);
- fclose($f);
- } else {
- echo "Wrong username or password";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement