Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once '../includes/class.session.php';
- require_once '../includes/function.php';
- require_once '../includes/class.user.php';
- if ($session->isLoggedIn()) {
- redirectTo("index.php");
- }
- if (isset($_POST['username'])) {
- $username = trim($_POST['username']);
- $password = trim($_POST['password']);
- // Check database to see if username/password exist.
- $user = User::authenticate($username, $password);
- if ($user) {
- $session->login($user);
- redirectTo("index.php");
- } else {
- echo "FEJL";
- }
- }
- ?>
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
- Username: <input type="text" name="username" maxlength="30" /> <br />
- Password: <input type="text" name="password" maxlength="30" /> <br />
- <input type="submit" name="login" value="Login" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement