Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once ('library/util.php');
- include_once ('library/user.php');
- $loginError=false;
- if ($_POST) {
- $username=$_POST['username'];
- $password=$_POST['password'];
- if (authenticate($username,$password)) {
- session_start();
- $_SESSION['name'] = $_POST['username'];
- redirect('index.php');
- } else {$loginError=true;}
- } //ends if ($_POST)
- // HOMEWORK
- // if authentication fails, show them the form and an error
- // message to that effect
- include 'includes/header.php';
- ?>
- <form method="POST" action="login.php">
- <?php
- if ($loginError) {
- echo ("<p class=\"red\">Your user name or password is incorrect, please try again</p>");
- }
- ?>
- <label for="username">Username</label>
- <input type="text" name="username"/>
- <label for="password">password</label>
- <input type="password" name="password"/>
- <input type="submit"/>
- </form>
- <?php include 'includes/footer.php'?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement