require_once 'Model/dbclass.php';
$dbObj = new Model_DBClass();
if (isset($_POST['sub'])) {
    /*------------------------------- */
    require_once 'Model/Authentication.php';
    $authenticationObj = new Model_Authentication();
    $data["user_name"] = $_POST["login_name"];
    $data["user_password"] = $_POST["login_password"];
    /*------------------------------- */
    if (!empty($data["user_name"]) && !empty($data["user_password"])) {
        /*$data["password"] = md5($pass);*/
        $data["password"] = $pass;
        $result = $authenticationObj->loginUser($data);
        $num = $authenticationObj->numRows($result);
        if ($num == 1) {
            $row = $authenticationObj->fetchObject($result);
            $_SESSION["user_id"] = $row->user_id;
            $_SESSION["user_name"] = $row->user_name;
            $_SESSION["status"] = $row->status;
            echo '<script>window.location = "index.php?status=1"; </script>';
        } else {
            echo '<script>window.location = "index.php?status=0"; </script>';
        }
    }
}
?>

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie ie7 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie ie8 no-js" lang="en"> <![endif]-->