<?php
/**
 * HTML Login Form
 *
 * PHP version 7.3
 *
 * @package        SMS
 * @version        Release 1.0.0
 * @create_by      Mohammad aljaouni
 * @create_date    10-08-2020
 * @edited_by      Mohammad aljaouni
 * @last_edit_date 10-08-2020
 * @todo           Nothing
 */
ob_start();
session_start();

//Validation For Includeed Tree
$chain = "AWdrh78y892Djk*^523*%$#ghgHGHia&%$*)AsfdsLJnLaad";
include("includeInformation.php");

//Page Content Settings
$disableSiteHeader = true;
$disableSiteFooter = true;
$callLoginValidation = true;
$bodyClass = 'class="bg-primary bg-pattern"';
include("header.php");

$_SESSION["loginCheck"] = md5(date("Y-m-d h").rand(10000,999999));
?>
<!-- Start Login page -->
    <!-- Start Lang Button Section-->
    <div class="home-btn">
        <button type="button" class="btn waves-effect" id="page-header-flag-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <img class="" src="assets/images/<?php echo $_SESSION['langSymbol'];?>/flags/<?php echo $languageArray[$_SESSION["language"]]['languageSymbol']?>.jpg" alt="Header Language" height="20">
        </button>
        <div class="dropdown-menu dropdown-menu-right">

            <!-- item-->
            <a href="changeLanguage.php?setNewLanguage=2" class="dropdown-item notify-item">
                <img src="assets/images/<?php echo $_SESSION['langSymbol'];?>/flags/en.jpg" alt="user-image" class="mr-2" height="16"><span class="align-middle"><?php echo $languageArray[2]['languageName']?></span>
            </a>

            <!-- item-->
            <a href="changeLanguage.php?setNewLanguage=1" class="dropdown-item notify-item">
                <img src="assets/images/<?php echo $_SESSION['langSymbol'];?>/flags/ar.jpg" alt="user-image" class="mr-2" height="20"><span class="align-middle"><?php echo $languageArray[1]['languageName']?></span>
            </a>

        </div>
    </div>
    <!-- End Lang Button Section-->

    <!-- Start Login Form -->
    <div class="account-pages my-5 pt-sm-5">
        <div class="container">
            <!-- Start Logo Row-->
            <div class="row">
                <div class="col-lg-12">
                    <div class="text-center mb-5">
                        <a class="logo"><img src="assets/images/<?php echo $_SESSION['langSymbol'];?>/logo-light.png" height="auto" width="230" alt="logo"></a>
                    </div>
                </div>
            </div>
            <!-- End Logo Row-->

            <!-- Start Form Row-->
            <div class="row justify-content-center">
                <div class="col-xl-5 col-sm-8">
                    <div class="card">
                        <div class="card-body p-4">
                            <div class="p-2">
                                <h5 class="mb-5 text-center"><?php echo $button["login"];?></h5>
                                <form class="form-horizontal needs-validation"  id="loginForm" action="checkUser.php" autocomplete="off" method="post">

                                    <div class="row">
                                        <?php
                                        if(!empty($_GET["res"]))
                                            echo result($_GET["res"]);
                                        ?>
                                        <div class="col-md-12">
                                            <div class="form-group form-group-custom mb-4">
                                                <input type="text" class="form-control" value="<?php echo !empty($_COOKIE['cookname'])?$_COOKIE['cookname']:""?>" name="user"  id="user" autocomplete="off" required  onchange="this.setAttribute('value', this.value);">
                                                <label for="user"><?php echo $loginLBL["username"]?></label>
                                            </div>

                                            <div class="form-group form-group-custom mb-4">
                                                <input type="password" class="form-control" value="<?php echo !empty($_COOKIE['cookpass'])?$_COOKIE['cookpass']:""?>" name="pass" id="pass" autocomplete="off" required  onchange="this.setAttribute('value', this.value);">
                                                <label for="pass"><?php echo $loginLBL["password"]?></label>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="custom-control custom-checkbox">
                                                        <input type="checkbox" class="custom-control-input" id="remember" name="remember" <?php echo !empty($_COOKIE['cookuser']) || !empty($_COOKIE['cookpass'])?"checked":""?>>
                                                        <label class="custom-control-label" for="remember"><?php echo $loginLBL["remember"]?></label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="text-md-right mt-3 mt-md-0">
                                                        <a href="forgetPassword.php" class="text-muted"><i class="mdi mdi-lock"></i> <?php echo $forgetLBL["forgetPassword"]?></a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="mt-4">
                                                <button class="btn btn-success btn-block waves-effect waves-light" type="submit"><?php echo $button["login"]?></button>
                                            </div>
                                        </div>
                                    </div>
                                    <input type="hidden" name="loginCheck" value="<?php echo $_SESSION["loginCheck"]?>">
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- End Form Row-->
        </div>
    </div>
    <!-- End Login Form -->

    <!-- start auth-footer -->
    <footer class="footer text-center auth-footer">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <?php echo $footer["copy"]?>
                </div>
            </div>
        </div>
    </footer>
    <!-- end auth-footer -->
<!-- End Login page -->
<?php
include("footer.php");
ob_end_flush();
?>

