<?php

require_once('config.php');

require_once('classes/user.php');

$user = new User();

if(APP_VERSION == '3.0') {
    $user->check_db1();
}

$app_settings = $user->getAppSettings();

$post_data['remember'] = 0;
$post_data['username'] = "";
$post_data['message']  = "";

if(isset($_POST['submit_far'])){
    $post_data['remember'] = empty($_POST['remember']) ? 0 : 1;
    $post_data['username'] = $_POST['username'];
    $post_data['password'] = $_POST['password'];

    if(!$user->auth($post_data['username'],$post_data['password']))
    {
        $post_data['message'] = 'Incorrect username or password!';
    }else{
        header('Location: dashboard.php');
        die();
    }
}

include('templates/login.php');