Guest User

Untitled

a guest
Dec 13th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. require_once('config.php');
  3. if( $user->is_logged_in() ){ header('Location: index.php'); exit(); }
  4. if(isset($_POST['submit'])){
  5. if (!isset($_POST['username'])) $error[] = "Please fill out all fields";
  6. if (!isset($_POST['password'])) $error[] = "Please fill out all fields";
  7. $username = $_POST['username'];
  8. if ( $user->isValidUsername($username)){
  9. if (!isset($_POST['password'])){
  10. $error[] = 'A password must be entered';
  11. }
  12. $password = $_POST['password'];
  13. if($user->login($username,$password)){
  14. $_SESSION['username'] = $username;
  15. header('Location: index.php');
  16. exit;
  17. } else {
  18. $error[] = 'Wrong username or password or your account has not been activated.';
  19. }
  20. }else{
  21. $error[] = 'Usernames are required to be Alphanumeric, and between 3-16 characters long';
  22. }
  23. }
  24. ?>
  25.  
  26. if( $user->is_logged_in() ){ header('Location: profile.php'); exit(); }
Add Comment
Please, Sign In to add comment