Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "Functions.php";
- if (array_key_exists('login_submit', $_POST)) {
- $filepath = "./user_data.dat";
- $Master_user_array = arrayfile_to_array($filepath);
- if (array_key_exists(strtolower($_POST['log_username']), $Master_user_array)) {
- if ($_POST['log_password'] == $Master_user_array[strtolower($_POST['log_username'])]['password']) {
- echo "{$_POST['log_username']} logged in.";
- die;
- } else {
- echo 'wrong password, try again';
- }
- }
- else {
- print "User {$_POST['username']} not found. <br>";
- }
- }
- if (array_key_exists('create_new_user', $_POST)) {
- header("Location: Create_New_User.php");
- exit;
- }
- ?>
- <form action = '<?php echo $_SERVER['PHP_SELF'] ?>' method= 'post'>
- Username: <br>
- <INPUT TYPE="TEXT" name="log_username" value = "<?php if (isset($_POST['username'])) echo $_POST['username'] ?>"><br>
- Password: <br>
- <INPUT TYPE="password" name = 'log_password'><br><br>
- <INPUT TYPE="SUBMIT" name = 'login_submit' value="Login">
- <br>
- <INPUT TYPE="SUBMIT" name = 'create_new_user' value="Create New User">
- </form>
Add Comment
Please, Sign In to add comment