LobbySIO/signin.php

135 lines
8.0 KiB
PHP

<?php
/*
* Copyright (C) 2018 josh.north
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
ini_set('session.gc_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP
session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users();
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
if (isset($session_user)) { // GET UID OR SET TO KIOSK
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
if(!isset($app_disp_lang)) {
$app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
$siteidcookie = filter_input(INPUT_COOKIE, 'app_site'); // SETUP SITE
foreach($SiteInfo->getSite("0", $uid, "0", "0") as $arr) {
$lookup_array[$arr['sites_id']]=1; }
if(isset($lookup_array[$siteidcookie])) {
$siteid = $siteidcookie; } else { $siteid = "1"; }
if(!isset($siteid)) { $siteid="1"; }
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); // SETUP TRANSLATOR
$transLang = $Translate->userLanguage();
$VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo();
$app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?>
<!-- CONTENT START -->
<div class="container">
<div class="row">
<div class="col-sm">
<h2><i class="fas fa-sign-in-alt"></i> <?php echo $transLang['SIGNIN']; ?></h2>
</div>
</div>
<form name="form-signin" class="needs-validation" action="signin_1.php" method="post" novalidate>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q1" required>
<label class="form-check-label" for="q1"><b>I have NOT experienced any of the following symptoms in the past 48 hours.</b><br>Fever, chills, cough, shortness of breath, fatigue, muscle or body aches, headache, new loss of taste or smell, sore throat, congestion or runny nose, nausea or vomiting, diarrhea.</label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q2" required>
<label class="form-check-label" for="q2"><b>I am NOT isolating or quarantining due to a positive test for COVID-19 nor do I believe that I may be sick with COVID-19.</b></label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q3" required>
<label class="form-check-label" for="q3"><b>I have NOT been in close physical contact in the last 14 days with:</b><br>Anyone who is known to have laboratory-confirmed COVID-19? OR Anyone who has any symptoms consistent with COVID-19?</label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q4" required>
<label class="form-check-label" for="q4"><b>I am NOT currently waiting on the results of a COVID-19 test.</b><br>IMPORTANT: ANSWER "NO" IF YOU ARE WAITING ON THE RESULTS OF A PRE-TRAVEL OR POST-TRAVEL COVID-19 TEST</label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q5" required>
<label class="form-check-label" for="q5"><b>I have NOT traveled in the past 10 days.</b><br>Travel is defined as any trip that is overnight AND on public transportation (plane, train, bus, Uber, Lyft, cab, etc.) OR any trip that is overnight AND with people who are not in your household.</label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="form-group form-row">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="q6" required>
<label class="form-check-label" for="q6"><b>I certify that my responses are true and correct.</b><br>All visitors must answer the above questions and then certify their answers are true and correct.</label>
<div class="invalid-feedback">You must answer to proceed.</div>
</div>
</div>
<div class="row">
<div class="col">
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['NEXT']; ?></button>
</div>
</div>
</form>
</div>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
<!-- CONTENT END -->
<?php }; require_once("inc/footer.inc.php");