<?php
$destination = isset($_GET['destination']) ? $_GET['destination'] : '';
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
//$appVersion = 'v1.1.10';
?>

<?
ob_start();

include getenv("DOCUMENT_ROOT")."/include/session_include.php";


require_once getenv("DOCUMENT_ROOT")."/lib/MobileDetect.php";
$detect = $detect = new \Detection\MobileDetect;

$cfg = $jdb->fQuery("SELECT cfg_app_version FROM tbl_config LIMIT 1", "config error");
$appVersion = $cfg['cfg_app_version'] ?? '';

if ($_SESSION['ss_LOGIN'] == 1) {
	$msg = "You are already logged in. Please proceed to the main page.";
	$func -> modalMsg ($msg, "/index_intranet.php");	
	exit;
}

?>


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>GOI</title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <!-- Favicons -->
  <link href="assets/img/cropped-green-oil-favicon-192x192.png" rel="icon">
  <link href="assets/img/cropped-green-oil-favicon-192x192.png" rel="apple-touch-icon">

  <!-- Google Fonts -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,600;1,700&family=Amatic+SC:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">

  <!-- Vendor CSS Files -->
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
  <link href="assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="assets/css/main.css" rel="stylesheet">
  <link href="assets/css/table-style.css" rel="stylesheet">

</head>

<script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>

<script type="text/javascript">
    var CaptchaCallback = function() {
        grecaptcha.render('RecaptchaField1', {'sitekey' : '6LcrsY0sAAAAAHOpHP2HTaGYkb8szuaSiSX2KgvS'});
        grecaptcha.render('RecaptchaField2', {'sitekey' : '6LcrsY0sAAAAAHOpHP2HTaGYkb8szuaSiSX2KgvS'});
    };
</script>

<style>
@media (max-width:575px) {
    #rc-imageselect, .g-recaptcha {
        transform:scale(0.70);
        transform-origin:0 0;
        margin-bottom: -20px;
    }
}
</style>

<body>


<? if( $detect->isMobile() || $detect->isTablet() ){ ?>
<? } else { ?>

  <!-- ======= Hero Section ======= -->
  

<? } ?>


  <main id="main" class="main">

    <section id="section-login" class="page">
      <div class="container section-inner" data-aos="fade-up">

        <div class="section-header" style="padding-bottom: 0;">
          <h2>Welcome to GOI Intranet</h2>
        </div>



          <div class="container">
            <form method="post" role="form" class="form-login" action="/lib/login_process.php" data-aos="fade-up" data-aos-delay="100">
            			<input type=hidden name=action value=login>
            			<input type=hidden name=destination value=<?=$destination?>>
									<input type=hidden name=mode value=<?=$mode?>>
																	
                  <input type="email" class="form-control" name="confirmID" id="email" required placeholder="Your Email" data-msg="Please enter a valid email">
                  
                  <input type="password" class="form-control" name="confirmPW" id="password" required placeholder="Password"  data-msg="Please enter a password">
                  <label><div class="g-recaptcha" id="RecaptchaField1" required="required" required ></div></label>
                  <div class="text-center"><button class="btn-primary" type="submit">LOGIN</button></div>
            </form>
            <div class="text-center mt-3">
              <small class="text-muted">
                <a href="https://docs.google.com/spreadsheets/d/1PsjWNuUNyjZv7AuFSJwm5m_rsj36d9q19r27PhZp43M/edit?usp=sharing" target="_blank">
                  <?=$appVersion?>
                </a>
              </small>
            </div>
          </div><!-- End login Form -->


      </div>
    </section><!-- End Book A Table Section -->


  </main><!-- End #main -->


  <!-- ======= Footer ======= -->
  <footer id="footer" class="footer">

    <div class="container">
      <div class="copyright">
        Copyright &copy; 2022 Green Oil Inc. All Rights Reserved.
      </div>
      
    </div>


  </footer><!-- End Footer -->
  <!-- End Footer -->

  <a href="#" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <div id="preloader"></div>

  <!-- Vendor JS Files -->
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
  <script src="assets/vendor/purecounter/purecounter_vanilla.js"></script>
  <script src="assets/vendor/swiper/swiper-bundle.min.js"></script>

  <!-- jQuery JS -->
  <script src="/assets/js/vendor/jquery-3.3.1.min.js"></script>

  <!-- Bootstrap JS -->
  <script src="/assets/js/vendor/bootstrap.min.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>

  <!-- Template Main JS File -->
  <script src="assets/js/main.js"></script>

</body>

</html> 