<?php
if(isset($_GET['addcon']))
{
    session_start();
    include('../include/connection.php');
    require_once '../lib/dbconfig.php';
    //require_once 'lib/custom.php';
    include('../include/app_config.php');
    include('../lib/app_stat.php');
}
if(isset($_POST['login']))
{
    $login = $user->login($_POST['email'], $_POST['password']);
    if($login)
    {
        if($_SESSION['user_role'] == CLIENT_USER_KEY)
        {
            echo '<script>window.location="client-area"</script>';
        }
        else
        {
            echo '<script>window.location="admin/"</script>';
        }
    }
    else 
    {
        echo '<div class="alert alert-danger">';
        foreach($user->errormsg as $error)
        {
            echo "<span>".$error."</span>";
        }
        echo '</div>';
    }
}
?>