Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Start by including the config file and checking if the admin is logged in.
- require_once('../includes/db_connect.php');
- //if not logged in redirect to login page
- if(!$user->is_logged_in()){ header('Location: login.php'); }
- ?>
- <!--Here is the HTML for the login form-->
- <form action="" method="post">
- <p><label>Username</label><input type="text" name="username" value="" /></p>
- <p><label>Password</label><input type="password" name="password" value="" /></p>
- <p><label></label><input type="submit" name="submit" value="Login" /></p>
- </form>
- <?php
- //process the login form if submitted correctly
- if(isset($_POST['submit'])){
- $username = trim($_POST['username']);
- $password = trim($_POST['password']);
- if($user->login($username,$password)){
- //logged in return to index page
- header('Location: index.php');
- exit;
- } else {
- $message = '<p class="error">Wrong username or password</p>';
- }
- }//end if submit
- if(isset($message)){ echo $message; }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement