Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('config.php');
- if( $user->is_logged_in() ){ header('Location: index.php'); exit(); }
- if(isset($_POST['submit'])){
- if (!isset($_POST['username'])) $error[] = "Please fill out all fields";
- if (!isset($_POST['password'])) $error[] = "Please fill out all fields";
- $username = $_POST['username'];
- if ( $user->isValidUsername($username)){
- if (!isset($_POST['password'])){
- $error[] = 'A password must be entered';
- }
- $password = $_POST['password'];
- if($user->login($username,$password)){
- $_SESSION['username'] = $username;
- header('Location: index.php');
- exit;
- } else {
- $error[] = 'Wrong username or password or your account has not been activated.';
- }
- }else{
- $error[] = 'Usernames are required to be Alphanumeric, and between 3-16 characters long';
- }
- }
- ?>
- if( $user->is_logged_in() ){ header('Location: profile.php'); exit(); }
Add Comment
Please, Sign In to add comment