Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //start session
- session_start();
- include_once('user.php');
- $user = new User();
- if(isset($_POST['login'])){
- $attempts=0;
- $username = $user->escape_string($_POST['username']);
- $password = $user->escape_string($_POST['password']);
- $auth = $user->check_login($username, $password);//authentication
- if(!$auth){
- $_SESSION['message'] = 'Invalid username or password '.$attempts.'';
- header('location:index.php');
- }
- else{
- $_SESSION['user'] = $auth;
- header('location:home.php');
- }
- }
- else{
- $_SESSION['message'] = 'You need to login first';//this part is to check your $postlogin=name of submit button
- header('location:index.php');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement