Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once('UUser.php');
- $error = "";
- if(isset($_POST['login'])){
- $username = $_POST["username"];
- $password = $_POST["password"];
- $object = new User();
- $object->username= $username;
- $object->password= $password;
- if($object->isAuthenticated()){
- $_SESSION['username'] = $username;
- header("Location: Page.php"); exit();
- }
- else {
- $error = '<div>Login has failed!</div>';
- }
- echo $error;
- }
- ?>
- <title>Login Form</title>
- <form action="" method="post">
- <h2>Please Log in</h2>
- <label>Username</label>
- <input type="text" name="username" placeholder="Username" value="" required autofocus>
- <label>Password</label>
- <input type="password" name="password" placeholder="Password" value="" required>
- <button name="login" type="submit">Log in</button>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement