16 Commits

Author SHA1 Message Date
0b4dcefd7e 0.18-beta - breakout sign-in steps for smaller screens 2019-01-28 13:50:56 -05:00
658b5ca9bb Tweaks 2018-10-22 13:16:41 -04:00
89f18304d3 Tweaks 2018-10-22 13:15:17 -04:00
454b736647 Tweaks 2018-10-22 11:50:17 -04:00
4b679cc17d Tweaks 2018-10-22 11:35:22 -04:00
e81f92a0bf Add EMEA fields 2018-10-22 10:32:17 -04:00
957b50de20 Add EMEA fields 2018-10-22 10:27:47 -04:00
044596271f Add EMEA fields 2018-10-22 10:23:22 -04:00
9745ad620f Add EMEA fields 2018-10-22 10:19:42 -04:00
3083aabb3d Add EMEA fields 2018-10-22 10:10:38 -04:00
34c531b74c Add EMEA fields 2018-10-22 09:59:34 -04:00
c4e0fcc8c4 Fixes uid error on cookie fail 2018-10-19 22:36:41 -04:00
d3dd24e3c1 Fixes uid error on cookie fail 2018-10-19 20:13:06 -04:00
3d94110404 Fixes version, lang, and updates sql schema. v0.16-beta 2018-10-19 19:40:42 -04:00
f3563100bb Fixes for several issues. Closes #1, closes #2, closes #3, and closes #5. 2018-10-19 19:00:44 -04:00
b978dfb077 Tweak report 2018-10-16 11:18:34 -04:00
24 changed files with 1060 additions and 538 deletions

195
assets/mysqlSchema.sql Executable file → Normal file
View File

@@ -22,103 +22,76 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
-- --------------------------------------------------------
--
-- Table structure for table `lsio_idtypes`
--
DROP TABLE IF EXISTS `lsio_idtypes`;
CREATE TABLE `lsio_idtypes` (
`id` tinyint(3) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_idtypes`
--
INSERT INTO `lsio_idtypes` (`id`, `name`) VALUES
(3, 'PASSPORT'),
(2, 'STATEID'),
(1, 'UNAVAIL');
-- --------------------------------------------------------
--
-- Table structure for table `lsio_sites`
--
DROP TABLE IF EXISTS `lsio_sites`;
CREATE TABLE `lsio_sites` (
`id` tinyint(3) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`name` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LOCATION CODE',
`timezone` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'ISO TIMEZONE'
`timezone` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'ISO TIMEZONE',
`region` varchar(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'US, CAN, EMEA'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_sites`
--
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`) VALUES
(1, 'NOSITE', 'UTC'),
(2, 'Default', 'America/New_York');
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`, `region`) VALUES
(1, 'NOSITE', 'UTC', 'NO'),
(2, 'Default Site', 'America/New_York', 'US');
-- --------------------------------------------------------
--
-- Table structure for table `lsio_users`
--
DROP TABLE IF EXISTS `lsio_users`;
CREATE TABLE `lsio_users` (
`id` int(11) UNSIGNED NOT NULL,
`id` int(10) UNSIGNED NOT NULL,
`username` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`password` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`email` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`created` datetime NOT NULL,
`firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`usertype` int(11) UNSIGNED NOT NULL,
`usertype` int(10) UNSIGNED NOT NULL,
`timezone` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_users`
--
INSERT INTO `lsio_users` (`id`, `username`, `password`, `email`, `created`, `firstname`, `lastname`, `usertype`, `timezone`) VALUES
(1, 'admin', '$2a$08$E5C4MP0JtsTmjIDm1aksgOHoascvOVNinOKKxAImrSnwL0zkd9FxO', 'a@b.c', '2015-02-18 19:50:31', 'System', 'Administrator', 1, '');
(1, 'admin', '$2a$08$FW0JtSQUEBXxf9aNDioIqeH/FA.ydCPTkgKUZEEWPECQpxwlRxZA.', 'admin@domain.com', '2015-02-18 19:50:31', 'System', 'Administrator', 1, ''),
(2, 'KIOSK', '', '', '2018-10-19 00:00:00', '', '', 3, ''),
(3, 'Default User', '$2a$08$FW0JtSQUEBXxf9aNDioIqeH/FA.ydCPTkgKUZEEWPECQpxwlRxZA.', 'user1@domain.com', '2018-09-23 00:00:00', 'First', 'Last', 2, '');
-- --------------------------------------------------------
--
-- Table structure for table `lsio_usertypes`
--
DROP TABLE IF EXISTS `lsio_users_sites`;
CREATE TABLE `lsio_users_sites` (
`sites_id` int(10) UNSIGNED NOT NULL COMMENT 'SITE ID',
`users_id` int(10) UNSIGNED NOT NULL COMMENT 'USER ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='PERMISSIONS LINK TABLE';
INSERT INTO `lsio_users_sites` (`sites_id`, `users_id`) VALUES
(1, 1),
(2, 1),
(1, 2),
(2, 2),
(1, 3),
(2, 3);
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_usertypes`;
CREATE TABLE `lsio_usertypes` (
`id` tinyint(3) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_usertypes`
--
INSERT INTO `lsio_usertypes` (`id`, `name`) VALUES
(1, 'ADMIN'),
(3, 'KIOSK'),
(4, 'SADMIN'),
(2, 'USER');
-- --------------------------------------------------------
--
-- Table structure for table `lsio_visits`
--
DROP TABLE IF EXISTS `lsio_visits`;
CREATE TABLE `lsio_visits` (
`id` int(15) UNSIGNED NOT NULL,
`id` int(10) UNSIGNED NOT NULL,
`firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`company` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
@@ -128,30 +101,21 @@ CREATE TABLE `lsio_visits` (
`signature` blob,
`escort_signature` blob,
`citizen` tinyint(3) UNSIGNED DEFAULT NULL,
`id_type` tinyint(3) UNSIGNED DEFAULT NULL,
`id_type` int(10) UNSIGNED DEFAULT NULL,
`id_checked` tinyint(3) UNSIGNED DEFAULT NULL,
`initials` varchar(5) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`badge` varchar(15) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`notes` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`site_id` tinyint(3) UNSIGNED DEFAULT NULL,
`reason` tinyint(3) UNSIGNED DEFAULT NULL,
`site_id` int(10) UNSIGNED DEFAULT NULL,
`reason` int(10) UNSIGNED DEFAULT NULL,
`approved` tinyint(4) DEFAULT '1' COMMENT '0 void, 1 unapproved, 2 approved'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Table structure for table `lsio_visittypes`
--
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visittypes`;
CREATE TABLE `lsio_visittypes` (
`id` tinyint(3) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
`name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_visittypes`
--
INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(2, 'ADDEQPT'),
(7, 'INSTHARD'),
@@ -163,45 +127,25 @@ INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(3, 'REMEQPT'),
(6, 'TESTING'),
(5, 'TOUR');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `lsio_idtypes`
--
-- --------------------------------------------------------
ALTER TABLE `lsio_idtypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_sites`
--
ALTER TABLE `lsio_sites`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_users`
--
ALTER TABLE `lsio_users`
ADD PRIMARY KEY (`id`),
ADD KEY `users_ibfk_1` (`usertype`);
--
-- Indexes for table `lsio_usertypes`
--
ALTER TABLE `lsio_users_sites`
ADD UNIQUE KEY `user_site_perm` (`sites_id`,`users_id`) USING BTREE,
ADD KEY `users_id` (`users_id`);
ALTER TABLE `lsio_usertypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_visits`
--
ALTER TABLE `lsio_visits`
ADD PRIMARY KEY (`id`),
ADD KEY `site_id` (`site_id`),
@@ -209,49 +153,30 @@ ALTER TABLE `lsio_visits`
ADD KEY `id_checked` (`id_checked`),
ADD KEY `citizen` (`citizen`),
ADD KEY `id_type` (`id_type`);
--
-- Indexes for table `lsio_visittypes`
--
ALTER TABLE `lsio_visittypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `lsio_idtypes`
--
-- --------------------------------------------------------
ALTER TABLE `lsio_idtypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `lsio_sites`
--
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_sites`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `lsio_users`
--
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `lsio_usertypes`
--
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
ALTER TABLE `lsio_usertypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `lsio_visits`
--
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_visits`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
--
-- AUTO_INCREMENT for table `lsio_visittypes`
--
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
ALTER TABLE `lsio_visittypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=11;
-- --------------------------------------------------------
ALTER TABLE `lsio_users`
ADD CONSTRAINT `lsio_users_ibfk_1` FOREIGN KEY (`usertype`) REFERENCES `lsio_usertypes` (`id`);
ALTER TABLE `lsio_users_sites`
ADD CONSTRAINT `lsio_users_sites_ibfk_3` FOREIGN KEY (`sites_id`) REFERENCES `lsio_sites` (`id`),
ADD CONSTRAINT `lsio_users_sites_ibfk_4` FOREIGN KEY (`users_id`) REFERENCES `lsio_users` (`id`);
ALTER TABLE `lsio_visits`
ADD CONSTRAINT `lsio_visits_ibfk_1` FOREIGN KEY (`id_type`) REFERENCES `lsio_idtypes` (`id`),
ADD CONSTRAINT `lsio_visits_ibfk_2` FOREIGN KEY (`reason`) REFERENCES `lsio_visittypes` (`id`),
ADD CONSTRAINT `lsio_visits_ibfk_3` FOREIGN KEY (`site_id`) REFERENCES `lsio_sites` (`id`);

View File

@@ -1,29 +1,53 @@
<?php
require_once __DIR__ . '/../autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
/*
* 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();
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
ob_start(); // OUTPUT BUFFER
if (isset($_SESSION['user_id'])): $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); endif; // SEE IF WE ARE LOGGED IN AND PULL NAME IF SO
$session_status = $StaticFunctions->getSessionStatus(); // SET A STATUS
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();
ob_start(); // OUTPUT BUFFER
$session_status = $StaticFunctions->getSessionStatus(); // SET A STATUS
$defaulttimezone = $StaticFunctions->getDefaultTZ();
date_default_timezone_set('UTC'); // DEFAULT TO UTC
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING
if(!isset($_COOKIE['app_disp_lang'])) { // IF NO LANGUAGE COOKIE, SET LANG TO APP DEFAULT, OTHERWISE USE COOKIE LANGUAGE
$app_disp_lang=$StaticFunctions->getDefaultLanguage();
} else {
$app_disp_lang=$_COOKIE['app_disp_lang'];
};
if(!isset($_COOKIE['app_site'])) { // LIKE LANGUAGE, DEFAULT IF NO COOKIE
$siteid="NOT SET"; // AND TIMEZONE AGAIN
$timezone = "UTC"; // BUT THE MODAL SHOULD POP AND BLOCK ANYWAY
} else {
$siteid=$_COOKIE['app_site'];
$timezone = $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"];
};
$timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
date_default_timezone_set('UTC'); // DEFAULT TO UTC
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING
$timezone = $SiteInfo->getSite($siteid, "0", "0", "0")[0]["sites_timezone"]; // GET TIMEZONE FROM SITE ID
$timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
$timeplus->setTimezone(new DateTimeZone("$timezone"));
$timenow = $timeplus->format('Y-m-d H:i:s');
?>
@@ -97,19 +121,18 @@
<li class="nav-item<?php if ($app_current_pagename==$transLang['SIGNOUT']): echo " active"; endif; ?>"><a class="nav-link" href="signout.php"><i class="fas fa-sign-out-alt"></i> <?php echo $transLang['SIGNOUT']; ?></a></li>
</ul>
<ul class="navbar-nav mr-sm-2">
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGIN']): echo " active"; endif; ?>"><a class="nav-link" href="login.php"><i class="fas fa-cogs"></i> <?php echo $transLang['LOGIN']; ?></a></li>
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGIN']): echo " active"; endif; ?>"><a class="nav-link btn btn-sm btn-outline-success" href="login.php"><i class="fas fa-cogs"></i> </a></li>
<?php endif; ?>
<?php if ($session_status == true): ?>
<!-- MENU FOR ALL LOGGED IN - BOTTOM END -->
</ul>
<ul class="navbar-nav mr-sm-2">
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGOUT']): echo " active"; endif; ?>"><a class="nav-link" href="logout.php"><i class="fas fa-ban"></i> <?php echo $transLang['LOGOUT']; ?></a></li>
<li class="nav-item"><a class="nav-link<?php $sname=$SiteInfo->getSite($siteid, "0", "0", "0")[0]["sites_name"]; if($sname=="NOSITE") { echo " btn btn-sm btn-outline-warning"; } else { echo " btn btn-sm btn-outline-secondary"; }; ?>" href="#" data-toggle="modal" data-target="#sitetimeModal"><i class="fas fa-map-marker-alt"></i> <?php if ($sname=="NOSITE") {echo $transLang['NOSITE'];} else { echo $sname; } ?></a></li>
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGOUT']): echo " active"; endif; ?>"><a class="nav-link btn btn-sm btn-outline-danger" href="logout.php"><i class="fas fa-ban"></i> <?php echo $transLang['LOGOUT']; ?></a></li>
<?php endif; ?>
</ul>
<ul class="form-control-sm">
<form action="changelang.php" method="post" name="changelang" class="changelang">
<div class="input-group mb-3">
<select class="custom-select" id="app_disp_lang" aria-label="Language" name="app_disp_lang">
<select class="form-control custom-select btn btn-outline-secondary" id="app_disp_lang" aria-label="Language" name="app_disp_lang">
<?php foreach(glob('src/Language/*.ini') as $file){
if(!is_dir($file)) { $filename=basename(preg_replace('/\.[^.]+$/','',preg_replace('/\.[^.]+$/','',$file))); }; ?>
<option value="<?php echo $filename; ?>"<?php if ($filename==$app_disp_lang) { echo " selected"; }; ?>><?php echo strtoupper($filename); ?></option>
@@ -127,7 +150,7 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="Site"><?php echo $transLang['CHOOSE']; ?> <?php echo $transLang['SITE']; ?></h5>
<h5 class="modal-title" id="Site"><i class="fas fa-map-marker-alt"></i> <?php echo $transLang['SITE']; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@@ -136,12 +159,11 @@
<form class="form-inline my-2 my-lg-0" action="changesite.php" method="post">
<div class="input-group mb-3">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary" type="button"><?php echo $transLang['SITE']; ?></button>
<button class="btn btn-outline-secondary" type="button"><?php echo $transLang['CHOOSE']; ?></button>
</div>
<select class="custom-select" id="site" aria-label="Site" name="site">
<option selected><?php echo $transLang['CHOOSE']; ?></option>
<?php foreach($SiteInfo->getSiteInfo("%") as $row): ?>
<option value="<?php echo $row['sites_id']; ?>"><?php echo $row['sites_name']; ?></option>
<select class="custom-select" id="site" aria-label="Site" name="site" required>
<?php foreach($SiteInfo->getSite("0", $uid, "0", "0") as $row): ?>
<option value="<?php echo $row['sites_id']; ?>"<?php if ($row['sites_id']==$siteid) { echo " selected"; } ?>><?php if ($row['sites_name']=="NOSITE") {echo $transLang['NOSITE'];} else { echo $row['sites_name']; } ?></option>
<?php endforeach; ?>
</select>
<input class="btn" type="submit" value="<?php echo $transLang['SAVE']; ?>" />

View File

@@ -17,26 +17,38 @@
* 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(); // CLASSES
$Users = new \App\LobbySIO\Database\Users();
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();
$VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo();
$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(); // ADDITIONAL CLASSES
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions();
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['HOME']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-home"></i> '; // PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
$app_current_pagename = $transLang['HOME']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-home"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
?>
<!-- GUEST CONTENT START -->
@@ -129,7 +141,6 @@
?>
<div class="container">
<div class="row">
<div class="col-sm">
@@ -143,7 +154,7 @@
<table class="table">
<thead class="thead-dark">
<tr>
<th><?php echo $transLang['TIMEREASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['VALIDATIONS']; ?></th><th><?php echo $transLang['BADGEINITIALS']; ?></th><th><?php echo $transLang['ACTIONS']; ?></th><th>&nbsp</th>
<th><?php echo $transLang['TIMEREASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['VALIDATIONS']; ?></th><th><?php echo $transLang['BADGEINITIALS']; ?></th><?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?><th><?php echo $transLang['CARNUM'] . " / " . $transLang['SSANUM']; ?></th><?php }; ?><th><?php echo $transLang['ACTIONS']; ?></th><th>&nbsp</th>
</tr>
</thead>
<tbody>
@@ -152,6 +163,8 @@
$timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC'));
$timein->setTimezone(new DateTimeZone("$timezone"));
$timein_disp = $timein->format('Y-m-d H:i:s');
if(!empty($row['visits_carnum'])) { $carnum=$row['visits_carnum']; } else { $carnum="";};
if(!empty($row['visits_ssanum'])) { $ssanum=$row['visits_ssanum']; } else { $ssanum="";};
?>
<?php if($row['visits_approved']==2) { ?>
<tr class="alert alert-success">
@@ -171,13 +184,18 @@
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked" disabled>
<?php }; ?>
<label class="form-check-label" for="id_checked"><?php echo $transLang['ID_CHECKED']; ?></label><br>
<?php if($row['visits_citizen']==1) { ?>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { if($row['visits_citizen']==1) { ?>
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" checked disabled>
<?php } else { ?>
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" disabled>
<?php }; ?>
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label></td>
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label>
<?php }; ?>
</td>
<td><input type="text" id="badge" name="badge" class="form-control" autofocus disabled value="<?php echo $row['visits_badge']; ?>"> <input type="text" id="initials" name="initials" class="form-control" autofocus disabled value="<?php echo $row['visits_initials']; ?>"></td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<?php }; ?>
<td> </td>
<td><button type="submit" name="endvisit" value="<?php echo $row['visits_id']; ?>" class="btn btn-warning btn-block"><i class="fas fa-sign-out-alt"></i>&nbsp<?php echo $transLang['SIGNOUT']; ?></button><br>
<div>
@@ -199,16 +217,21 @@
<option value="<?php echo $row['idtypes_id']; ?>"><?php echo $transLang[$row['idtypes_name']]; ?></option><?php endforeach; ?>
</select>
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked">
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked" required>
<label class="form-check-label" for="id_checked"><?php echo $transLang['ID_CHECKED']; ?></label><br>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { ?>
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen">
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label>
<?php }; ?>
<td>
<input type="text" id="badge" name="badge" class="form-control<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['BADGE']; ?>" autofocus maxlength="15">
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
<input type="text" id="initials" name="initials" class="form-control<?php if( isset($initials_error) && $initials_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['INITIALS']; ?>" autofocus maxlength="5">
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
</td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<?php }; ?>
<td>
<button type="submit" name="approvevisit" value="<?php echo $visitid; ?>" class="btn btn-success btn-block"><i class="fas fa-thumbs-up"></i>&nbsp;<?php echo $transLang['APPROVE']; ?></button><br /><button type="submit" name="voidvisit" value="<?php echo $visitid; ?>" class="btn btn-danger btn-block" onsubmit="return confirm('<?php echo $transLang['VOID_WARNING']; ?>')"><i class="fas fa-thumbs-down"></i>&nbsp;<?php echo $transLang['VOID']; ?></button>
</td>

View File

@@ -17,23 +17,35 @@
* 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(); // CLASSES
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($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['LOGIN']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
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();
$app_current_pagename = $transLang['LOGIN']; // 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 -->
@@ -60,9 +72,9 @@ endif;
<div class="container">
<div class="row">
<div class="col-sm">
<?php if(isset($_COOKIE['app_site'])) { $timezone = $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"]; } else {$timezone = "UTC";}; ?>
<p><b><?php echo $transLang['SITE']; ?>:</b> <?php echo $SiteInfo->getSiteInfo($siteid)[0]["sites_name"]; ?>
<br><b><?php echo $transLang['TIMEZONE']; ?>:</b> <?php echo $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"]; ?></p>
<p><b><?php echo $transLang['SITE']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; ?>
<br><b><?php echo $transLang['TIMEZONE']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_timezone"]; ?>
<br><b><?php echo $transLang['REGION']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"]; ?></p>
</div>
<div class="col-sm">
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#sitetimeModal"><?php echo $transLang['CHANGE']; ?></button>

View File

@@ -17,21 +17,35 @@
* 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(); // CLASSES
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['LOGOUT']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-sign-out"></i> '; // PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
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();
$app_current_pagename = $transLang['LOGOUT']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-sign-out"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?>
<!-- CONTENT START -->

View File

@@ -17,22 +17,35 @@
* 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(); // CLASSES
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($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['ACCOUNT']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';// PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
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();
$app_current_pagename = $transLang['ACCOUNT']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?>
<!-- CONTENT START -->

View File

@@ -17,25 +17,38 @@
* 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(); // CLASSES
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();
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['REPORTS']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> '; // PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
$app_current_pagename = $transLang['REPORTS']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?>
<!-- CONTENT START -->
@@ -70,8 +83,10 @@
</div>
<?php if (isset($_POST['repsite'])) { $currentrepsite = $_POST['repsite']; } else { $currentrepsite = "0"; }; ?>
<select name="repsite" class="form-control">
<?php if($session_user["0"]["users_usertype"] == "ADMIN") { ?>
<option value="all"<?php if ($currentrepsite == "all") {echo " selected";}; ?>><?php echo $transLang['ALL']; ?></option>
<?php foreach($SiteInfo->getSiteInfo("%") as $row): ?>
<?php } ?>
<?php foreach($SiteInfo->getSite("0", $uid, "0", "0") as $row): ?>
<option value="<?php echo $row['sites_id']; ?>"<?php if ($currentrepsite == $row['sites_id']) {echo " selected";}; ?>><?php echo $row['sites_name']; ?></option>
<?php endforeach; ?>
</select>
@@ -84,7 +99,7 @@
<div class="input-group-prepend " data-target=".datetimepicker-1" data-toggle="datetimepicker">
<div class="input-group-text "><i class="fa fa-calendar"></i>&nbsp <?php echo $transLang['START']; ?></div>
</div>
<input value="<?php if (isset($_POST['starttime'])) { echo $_POST['starttime']; }; ?>" name="starttime" type="text" class="datetimepicker-input form-control datetimepicker-1" id="datetimepicker-1" data-target=".datetimepicker-1" autocomplete="new-password" required />
<input name="starttime" type="text" class="datetimepicker-input form-control datetimepicker-1" id="datetimepicker-1" data-target=".datetimepicker-1" autocomplete="new-password" required />
</div>
</div>
<div class='col-sm'>
@@ -92,17 +107,17 @@
<div class="input-group-prepend" data-target=".datetimepicker-2" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i>&nbsp <?php echo $transLang['END']; ?></div>
</div>
<input value="<?php if (isset($_POST['endtime'])) { echo $_POST['endtime']; }; ?>" name="endtime" type="text" class="datetimepicker-input form-control datetimepicker-2" id="datetimepicker-2" data-target=".datetimepicker-2" autocomplete="new-password" required />
<input name="endtime" type="text" class="datetimepicker-input form-control datetimepicker-2" id="datetimepicker-2" data-target=".datetimepicker-2" autocomplete="new-password" required />
</div>
</div>
<script type="text/javascript">
$(function () {
$('.datetimepicker-1').datetimepicker({'sideBySide':true, 'format':'YYYY-MM-DD HH:mm:ss'});
$('.datetimepicker-1').datetimepicker({defaultDate:'<?php if (isset($_POST['starttime'])) { echo $_POST['starttime']; }; ?>', 'sideBySide':true, 'format':'YYYY-MM-DD HH:mm:ss'});
});
</script>
<script type="text/javascript">
$(function () {
$('.datetimepicker-2').datetimepicker({'sideBySide':true, 'format':'YYYY-MM-DD HH:mm:ss'});
$('.datetimepicker-2').datetimepicker({defaultDate:'<?php if (isset($_POST['endtime'])) { echo $_POST['endtime']; }; ?>', 'sideBySide':true, 'format':'YYYY-MM-DD HH:mm:ss'});
});
</script>
</div>
@@ -118,11 +133,11 @@
<?php if ($_POST['reporttype'] == "Default"): ?>
<div class="container-fluid">
<table id="report" class="table table-striped table-bordered">
<thead><tr><th><?php echo $transLang['IN']; ?></th><th><?php echo $transLang['OUT']; ?></th><th><?php echo $transLang['SITE']; ?></th><th><?php echo $transLang['COMPANY']; ?></th><th><?php echo $transLang['REASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['BADGE']; ?></th><th><?php echo $transLang['INITIALS']; ?></th><th><?php echo $transLang['CITIZEN']; ?></th><th><?php echo $transLang['ID_TYPE']; ?></th><th><?php echo $transLang['ID_CHECKED']; ?></th></tr></thead>
<thead><tr><th><?php echo $transLang['IN']; ?></th><th><?php echo $transLang['OUT']; ?></th><th><?php echo $transLang['SITE']; ?></th><th><?php echo $transLang['COMPANY']; ?></th><th><?php echo $transLang['REASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['BADGE']; ?></th><th><?php echo $transLang['INITIALS']; ?></th><?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?><th><?php echo $transLang['CARNUM']; ?></th><th><?php echo $transLang['SSANUM']; ?></th><?php } ?><?php if($SiteInfo->getSite($_POST['repsite'], $uid, "0", "0")[0]["sites_region"] == "US") { ?><th><?php echo $transLang['CITIZEN']; ?></th><?php } ?><th><?php echo $transLang['ID_TYPE']; ?></th><th><?php echo $transLang['ID_CHECKED']; ?></th></tr></thead>
<tbody>
<?php
$approval = "2";
if ($_POST['repsite'] == "all") { $selsite="%"; } else { $selsite=$_POST['repsite'];};
if ($_POST['repsite'] == "all") { $selsite="%"; } else { $selsite=$_POST['repsite'];}
foreach ($VisitInfo->getVisitInfo($selsite, $approval, "%", "%", "%", $_POST['starttime'], $_POST['endtime'], "%", "%") as $row):
$timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC'));
$timeout = new DateTime($row['visits_outtime'], new DateTimeZone('UTC'));
@@ -130,20 +145,26 @@
$timeout->setTimezone(new DateTimeZone("$timezone"));
$timein_disp = $timein->format('Y-m-d H:i:s');
$timeout_disp = $timeout->format('Y-m-d H:i:s');
if(!empty($row['visits_carnum'])) { $carnum=$row['visits_carnum']; } else { $carnum="";}
if(!empty($row['visits_ssanum'])) { $ssanum=$row['visits_ssanum']; } else { $ssanum="";}
?>
<tr>
<td><?php echo $timein_disp; ?></td>
<td><?php if (!empty($row['visits_outtime'])) {echo $timeout_disp; } else {echo $transLang['IN'];}; ?></td>
<td><?php echo $SiteInfo->getSiteInfo($row['visits_site_id'])[0]["sites_name"]; ?></td>
<td><?php if (!empty($row['visits_outtime'])) {echo $timeout_disp; } else {echo $transLang['IN'];} ?></td>
<td><?php echo $SiteInfo->getSite($row['visits_site_id'], $uid, "0", "0")[0]["sites_name"]; ?></td>
<td><?php echo $row['visits_company']; ?></td>
<td><?php echo $transLang[$VisitTypeInfo->getVisitTypeInfo($row['visits_reason'])[0]['visittypes_name']]; ?></td>
<td><?php echo $row['visits_lastname'] . ", " . $row['visits_firstname']; ?><br /><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50" alt="Signature" /></td>
<td><?php if (!empty($row['visits_escort'])) {echo $row['visits_escort'] . '<br /><img src="' . $row['visits_escort_signature'] . '" width="200" height="50" alt="Escort Signature" />'; } ?></td>
<td><?php echo $row['visits_badge']; ?></td>
<td><?php echo $row['visits_initials']; ?></td>
<td><?php if($row['visits_citizen']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; }; ?></td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?></td>
<td><?php echo $ssanum; ?></td>
<?php } ?>
<?php if($SiteInfo->getSite($_POST['repsite'], $uid, "0", "0")[0]["sites_region"] == "US") { ?> <td><?php if($row['visits_citizen']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; } ?></td> <?php } ?>
<td><?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'])[0]['idtypes_name']]; ?></td>
<td><?php if($row['visits_id_checked']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; }; ?></td>
<td><?php if($row['visits_id_checked']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; } ?></td>
</tr>
<?php endforeach; ?>
</tbody>

View File

@@ -17,23 +17,36 @@
* 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(); // CLASSES
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();
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
$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 -->
@@ -43,7 +56,7 @@
<h2><i class="fas fa-sign-in-alt"></i> <?php echo $transLang['SIGNIN']; ?></h2>
</div>
</div>
<form name="form-signin" class="form-signin" action="signin_display.php" method="post">
<form name="form-signin" class="form-signin" action="signin_2.php" method="post">
<div class="row">
<div class="col-sm">
<div class="input-group mb-3">
@@ -55,6 +68,26 @@
</div>
</div>
</div>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<div class="row">
<div class="col-sm">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['CARNUM']; ?></span>
</div>
<input type="text" id="company" name="carnum" class="form-control" placeholder="<?php echo $transLang['CARNUM']; ?>" required autofocus>
</div>
</div>
<div class="col-sm">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['SSANUM']; ?></span>
</div>
<input type="text" id="company" name="ssanum" class="form-control" placeholder="<?php echo $transLang['SSANUM']; ?>" required autofocus>
</div>
</div>
</div>
<?php }; ?>
<div class="row">
<div class="col-sm">
<div class="input-group mb-3">
@@ -65,104 +98,14 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['REASON']; ?></span>
</div>
<select class="custom-select" id="visit_type" aria-label="Visit Type" name="visit_type" required>
<option value="" selected><?php echo $transLang['SELECTREASON']; ?></option><?php foreach($VisitTypeInfo->getVisitTypeInfo("%") as $row): ?>
<option value="<?php echo $row['visittypes_id']; ?>"><?php echo $transLang[$row['visittypes_name']]; ?></option><?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0"><button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne"><?php echo $transLang['ESECTION']; ?></button></h5>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['ENAME']; ?>:</span>
</div>
<input type="text" id="escort" name="escort" class="form-control" placeholder="<?php echo $transLang['ETAG']; ?>" autofocus>
</div>
<h4><?php echo $transLang['ESIGNATURE']; ?>:</h4>
<div id="esignature-parent">
<div id="esignature"></div>
</div>
<input type="hidden" name="e_signature" id="e_signature"></input>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h4><?php echo $transLang['VSIGNATURE']; ?>:</h4>
<div id="vsignature-parent">
<div id="vsignature"></div>
</div>
<input type="hidden" name="v_signature" id="v_signature" required />
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<p><?php echo $transLang['ACKNOWLEDGEMENT']; ?><p>
<p><?php echo $transLang['GDPR_TEXT']; ?><p>
<p><a class="btn btn-outline-secondary btn-block" data-toggle="modal" data-target="#termsModalLong" href="<?php echo $StaticFunctions->getRules(); ?>"><?php echo $transLang['REFERENCE']; ?>:&nbsp;(<?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?>)</a></p>
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['SIGNIN']; ?></button>
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['NEXT']; ?></button>
</div>
</div>
</form>
</div>
<!-- TERMS MODAL START -->
<div class="modal fade" id="termsModalLong" tabindex="-1" role="dialog" aria-labelledby="termsModalLongTitle" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="termsModalLongTitle"><?php echo $transLang['TERMSTITLE']; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="<?php echo $transLang['CLOSE']; ?>">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<object type="application/pdf" data="<?php echo $StaticFunctions->getRules(); ?>" width="700" height="600">_</object>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $transLang['CLOSE']; ?></button>
</div>
</div>
</div>
</div>
<!-- TERMS MODAL END -->
<script>
$(document).ready(function() {
// Init jSignature for Escort field ONLY after we uncollapse the escort bootstrap div
$('#collapseOne').on('shown.bs.collapse', function () {
var $esignature = $("#esignature").jSignature();
true
$('#esignature').change(function() {
var data2 = $esignature.jSignature('getData');
$('#e_signature').val(data2);
});
});
// Init jSignature for Visitor field, onchange store in text field
var $vsignature = $("#vsignature").jSignature();
true
$('#vsignature').change(function() {
var data = $vsignature.jSignature('getData');
$('#v_signature').val(data);
});
});
$("form").submit(function() {
if($('#v_signature').val() == '') {
alert("<?php echo $transLang['SIGNATURE']; ?> <?php echo $transLang['REQUIRED']; ?>");
return false;
}
return true;
});
</script>
<!-- CONTENT END -->
<?php }; require_once("inc/footer.inc.php");

100
signin_2.php Normal file
View File

@@ -0,0 +1,100 @@
<?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 -->
<?php if (!empty($_POST)) { // PROCESS POST
if (empty($_POST['carnum'])) { $carnum="";} else {$carnum=$_POST['carnum'];};
if (empty($_POST['ssanum'])) { $ssanum="";} else {$ssanum=$_POST['ssanum'];};
if (empty($_POST['firstname'])) { $firstname="";} else {$firstname=$_POST['firstname'];};
if (empty($_POST['lastname'])) { $lastname="";} else {$lastname=$_POST['lastname'];};
if (empty($_POST['company'])) { $company="";} else {$company=$_POST['company'];};
?>
<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="form-signin" action="signin_3.php" method="post">
<div class="row">
<div class="col-sm">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['REASON']; ?></span>
</div>
<select class="custom-select" id="visit_type" aria-label="Visit Type" name="visit_type" required>
<option value="" selected><?php echo $transLang['SELECTREASON']; ?></option><?php foreach($VisitTypeInfo->getVisitTypeInfo("%") as $row): ?>
<option value="<?php echo $row['visittypes_id']; ?>"><?php echo $transLang[$row['visittypes_name']]; ?></option><?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<input type="hidden" name="carnum" id="carnum" value="<?php echo $carnum; ?>" />
<input type="hidden" name="ssanum" id="ssanum" value="<?php echo $ssanum; ?>" />
<input type="hidden" name="firstname" id="firstname" value="<?php echo $firstname; ?>" />
<input type="hidden" name="lastname" id="lastname" value="<?php echo $lastname; ?>" />
<input type="hidden" name="company" id="company" value="<?php echo $company; ?>" />
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['NEXT']; ?></button>
</div>
</div>
</form>
</div>
<?php } else { // EXIT IF NO POST
?>
<div class="container">
<h2><?php echo $transLang['NOSIGNIN']; ?></h2>
</div>
<?php }; ?>
<!-- CONTENT END -->
<?php }; require_once("inc/footer.inc.php");

144
signin_3.php Normal file
View File

@@ -0,0 +1,144 @@
<?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 -->
<?php if (!empty($_POST)) { // PROCESS POST
if (empty($_POST['carnum'])) { $carnum="";} else {$carnum=$_POST['carnum'];};
if (empty($_POST['ssanum'])) { $ssanum="";} else {$ssanum=$_POST['ssanum'];};
if (empty($_POST['firstname'])) { $firstname="";} else {$firstname=$_POST['firstname'];};
if (empty($_POST['lastname'])) { $lastname="";} else {$lastname=$_POST['lastname'];};
if (empty($_POST['company'])) { $company="";} else {$company=$_POST['company'];};
if (empty($_POST['visit_type'])) { $visit_type="";} else {$visit_type=$_POST['visit_type'];};
?>
<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="form-signin" action="signin_4.php" method="post">
<div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0"><button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne"><?php echo $transLang['ESECTION']; ?></button></h5>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3"><?php echo $transLang['ENAME']; ?>:</span>
</div>
<input type="text" id="escort" name="escort" class="form-control" placeholder="<?php echo $transLang['ETAG']; ?>" autofocus>
</div>
<h4><?php echo $transLang['ESIGNATURE']; ?>:</h4>
<div id="esignature-parent">
<div id="esignature"></div>
</div>
<input type="hidden" name="e_signature" id="e_signature"></input>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h4><?php echo $transLang['VSIGNATURE']; ?>:</h4>
<div id="vsignature-parent">
<div id="vsignature"></div>
</div>
<input type="hidden" name="v_signature" id="v_signature" required />
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<input type="hidden" name="carnum" id="carnum" value="<?php echo $carnum; ?>" />
<input type="hidden" name="ssanum" id="ssanum" value="<?php echo $ssanum; ?>" />
<input type="hidden" name="firstname" id="firstname" value="<?php echo $firstname; ?>" />
<input type="hidden" name="lastname" id="lastname" value="<?php echo $lastname; ?>" />
<input type="hidden" name="company" id="company" value="<?php echo $company; ?>" />
<input type="hidden" name="visit_type" id="visit_type" value="<?php echo $visit_type; ?>" />
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['SIGNIN']; ?></button>
</div>
</div>
</form>
</div>
<script>
$(document).ready(function() {
// Init jSignature for Escort field ONLY after we uncollapse the escort bootstrap div
$('#collapseOne').on('shown.bs.collapse', function () {
var $esignature = $("#esignature").jSignature();
true
$('#esignature').change(function() {
var data2 = $esignature.jSignature('getData');
$('#e_signature').val(data2);
});
});
// Init jSignature for Visitor field, onchange store in text field
var $vsignature = $("#vsignature").jSignature();
true
$('#vsignature').change(function() {
var data = $vsignature.jSignature('getData');
$('#v_signature').val(data);
});
});
$("form").submit(function() {
if($('#v_signature').val() == '') {
alert("<?php echo $transLang['SIGNATURE']; ?> <?php echo $transLang['REQUIRED']; ?>");
return false;
}
return true;
});
</script>
<?php } else { // EXIT IF NO POST
?>
<div class="container">
<h2><?php echo $transLang['NOSIGNIN']; ?></h2>
</div>
<?php }; ?>
<!-- CONTENT END -->
<?php }; require_once("inc/footer.inc.php");

121
signin_4.php Normal file
View File

@@ -0,0 +1,121 @@
<?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 -->
<?php if (!empty($_POST)) { // PROCESS POST
if (empty($_POST['carnum'])) { $carnum="";} else {$carnum=$_POST['carnum'];};
if (empty($_POST['ssanum'])) { $ssanum="";} else {$ssanum=$_POST['ssanum'];};
if (empty($_POST['firstname'])) { $firstname="";} else {$firstname=$_POST['firstname'];};
if (empty($_POST['lastname'])) { $lastname="";} else {$lastname=$_POST['lastname'];};
if (empty($_POST['company'])) { $company="";} else {$company=$_POST['company'];};
if (empty($_POST['visit_type'])) { $visit_type="";} else {$visit_type=$_POST['visit_type'];};
if (empty($_POST['v_signature'])) { $v_signature="";} else {$v_signature=$_POST['v_signature'];};
if (empty($_POST['e_signature'])) { $e_signature="";} else {$e_signature=$_POST['e_signature'];};
if (empty($_POST['escort'])) { $escort="";} else {$escort=$_POST['escort'];};
?>
<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="form-signin" action="signin_display.php" method="post">
<div class="row">
<div class="col">
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { echo "<p>" . $transLang['ACKNOWLEDGEMENT'] . "</p>"; } ?>
<p><?php echo $transLang['GDPR_TEXT']; ?><p>
<p><a class="btn btn-outline-secondary btn-block" data-toggle="modal" data-target="#termsModalLong" href="<?php echo $StaticFunctions->getRules(); ?>"><?php echo $transLang['REFERENCE']; ?>:&nbsp;(<?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?>)</a></p>
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<input type="hidden" name="carnum" id="carnum" value="<?php echo $carnum; ?>" />
<input type="hidden" name="ssanum" id="ssanum" value="<?php echo $ssanum; ?>" />
<input type="hidden" name="firstname" id="firstname" value="<?php echo $firstname; ?>" />
<input type="hidden" name="lastname" id="lastname" value="<?php echo $lastname; ?>" />
<input type="hidden" name="company" id="company" value="<?php echo $company; ?>" />
<input type="hidden" name="visit_type" id="visit_type" value="<?php echo $visit_type; ?>" />
<input type="hidden" name="v_signature" id="v_signature" value="<?php echo $v_signature; ?>" />
<input type="hidden" name="e_signature" id="e_signature" value="<?php echo $e_signature; ?>" />
<input type="hidden" name="escort" id="escort" value="<?php echo $escort; ?>" />
<button type="cancel" id="cancel" class="btn btn-lg btn-danger btn-block" name="cancel"><?php echo $transLang['CANCEL']; ?></button>
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['SIGNIN']; ?></button>
</div>
</div>
</form>
</div>
<!-- TERMS MODAL START -->
<div class="modal fade" id="termsModalLong" tabindex="-1" role="dialog" aria-labelledby="termsModalLongTitle" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="termsModalLongTitle"><?php echo $transLang['TERMSTITLE']; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="<?php echo $transLang['CLOSE']; ?>">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<object type="application/pdf" data="<?php echo $StaticFunctions->getRules(); ?>" width="700" height="600">_</object>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $transLang['CLOSE']; ?></button>
</div>
</div>
</div>
</div>
<!-- TERMS MODAL END -->
<?php } else { // EXIT IF NO POST
?>
<div class="container">
<h2><?php echo $transLang['NOSIGNIN']; ?></h2>
</div>
<?php }; ?>
<!-- CONTENT END -->
<?php }; require_once("inc/footer.inc.php");

View File

@@ -17,29 +17,44 @@
* 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(); // CLASSES
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();
$VisitActions = new \App\LobbySIO\Database\VisitActions();
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-file-signature"></i> ';// PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
$app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-file-signature"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?>
<!-- CONTENT START -->
<?php if (!empty($_POST)) { // PROCESS POST
echo $VisitActions->newVisit($_POST['firstname'], $_POST['lastname'], $_POST['company'], $_POST['visit_type'], $StaticFunctions->getUTC(), $_POST['v_signature'], $_POST['siteid'], "1", $_POST['e_signature'], $_POST['escort']);
if (empty($_POST['carnum'])) { $carnum="";} else {$carnum=$_POST['carnum'];};
if (empty($_POST['ssanum'])) { $ssanum="";} else {$ssanum=$_POST['ssanum'];};
echo $VisitActions->newVisit($_POST['firstname'], $_POST['lastname'], $_POST['company'], $_POST['visit_type'], $StaticFunctions->getUTC(), $_POST['v_signature'], $_POST['siteid'], "1", $_POST['e_signature'], $_POST['escort'], $carnum, $ssanum);
?>
<div class="container">
<div class="row">
@@ -62,8 +77,8 @@
</table>
</div>
<div class="row">
<h4><?php echo $transLang['ACKNOWLEDGEMENT']; ?></h4>
<h5><?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?></h5>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { echo "<p>" . $transLang['ACKNOWLEDGEMENT'] . "</p>"; } ?>
<p><?php echo $transLang['GDPR_TEXT']; ?><p>
</div>
</div>
<?php } else { // EXIT IF NO POST

View File

@@ -17,23 +17,37 @@
* 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(); // CLASSES
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();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions();
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['SIGNOUT']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';// PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
$app_current_pagename = $transLang['SIGNOUT']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?>
<!-- CONTENT START -->

View File

@@ -37,7 +37,7 @@ class Registry { const
DB_PRFX = 'lsio_', // DB table prefix
ORGANIZATION = 'Widgets, Inc', // Organization name
DEFAULTLANGUAGE = 'en', // Default language - make sure a translation file exists
ROWSPERPAGE = '5', // Rows per page on tables (does not include reports)
ROWSPERPAGE = '10', // Rows per page on tables (does not include reports)
MINPASS = '8', // Minimum password length
DEFAULTTZ = 'America/New_York' // DEFAULT TIME ZONE
;}

64
src/Database/SiteInfo.php Executable file → Normal file
View File

@@ -27,29 +27,61 @@ use App\LobbySIO\Config\Registry;
*/
class SiteInfo {
public function getSiteInfo ($siteid){
// Return Site Information array. 0 eliminates argument
public function getSite ($sites_id, $users_id, $rowsperpage, $offset) {
if ($sites_id == "0") { $c_sites_id = NULL; }
else { $c_sites_id = Registry::DB_PRFX . "sites.id LIKE \"$sites_id\""; }
if ($users_id == "0") { $c_users_id = NULL; }
else { $c_users_id = Registry::DB_PRFX . "users_sites.users_id LIKE \"$users_id\""; }
if ($c_sites_id === NULL AND $c_users_id === NULL) {
$c_where = NULL;
} elseif ($c_sites_id !== NULL AND $c_users_id !== NULL) {
$c_where = "WHERE " . $c_sites_id . " AND " . $c_users_id;
} elseif ($c_sites_id === NULL AND $c_users_id !== NULL) {
$c_where = "WHERE " . $c_users_id;
} elseif ($c_sites_id !== NULL AND $c_users_id === NULL) {
$c_where = "WHERE " . $c_sites_id;
}
if ($rowsperpage == "0") { $c_rowsperpage = NULL; }
else { $c_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; }
if ($offset == "0") { $c_offset = NULL; }
else { $c_offset = " OFFSET " . $offset; }
$query = "
SELECT
" . Registry::DB_PRFX . "sites.id as sites_id,
" . Registry::DB_PRFX . "sites.name as sites_name,
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
FROM " . Registry::DB_PRFX . "sites
WHERE " . Registry::DB_PRFX . "sites.id LIKE \"$siteid\"";
SELECT DISTINCT
" . Registry::DB_PRFX . "sites.id as sites_id,
" . Registry::DB_PRFX . "sites.name as sites_name,
" . Registry::DB_PRFX . "sites.region as sites_region,
" . Registry::DB_PRFX . "sites.timezone as sites_timezone,
" . Registry::DB_PRFX . "users_sites.users_id as users_sites_users_id
FROM " . Registry::DB_PRFX . "sites
JOIN " . Registry::DB_PRFX . "users_sites ON " . Registry::DB_PRFX . "sites.id=" . Registry::DB_PRFX . "users_sites.sites_id
" . $c_where . "
ORDER BY " . Registry::DB_PRFX . "sites.name ASC" . $c_rowsperpage . $c_offset;
$database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query);
return $rows;
}
public function getSiteName ($siteid) {
public function deleteSite ($siteid) {
$query = "
SELECT
" . Registry::DB_PRFX . "sites.id as sites_id,
" . Registry::DB_PRFX . "sites.name as sites_name
FROM " . Registry::DB_PRFX . "sites
WHERE " . Registry::DB_PRFX . "sites.id LIKE $siteid";
DELETE FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.id=\"$siteid\"
";
$database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query);
return $rows[0]["sites_name"];
$count = $database->runQuery($query);
return $count;
}
public function addSite ($sitename, $timezone, $region) {
$query = "
INSERT INTO " . Registry::DB_PRFX . "sites (" . Registry::DB_PRFX . "sites.name, " . Registry::DB_PRFX . "sites.timezone, " . Registry::DB_PRFX . "sites.region)
VALUES (\"$sitename\", \"$timezone\", \"$region\")
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
}

5
src/Database/Users.php Executable file → Normal file
View File

@@ -26,7 +26,7 @@ use App\LobbySIO\Config\Registry;
* @author josh.north
*/
class Users {
// Get site info as array by site id. Pass % for all.
// Get user info as array by user id. Pass % for all.
public function getUserInfo($userid, $rowsperpage, $offset) {
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
@@ -86,6 +86,7 @@ class Users {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) {
@@ -102,6 +103,7 @@ class Users {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function getUserType ($usertypeid){
@@ -122,6 +124,7 @@ class Users {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function getUserTypeInfo ($usertypeid) {

10
src/Database/VisitActions.php Executable file → Normal file
View File

@@ -35,6 +35,7 @@ class VisitActions {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function voidVisit ($visitid, $approved) {
@@ -45,6 +46,7 @@ class VisitActions {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function approveVisit ($approvevisit, $id_type, $id_checked, $citizen, $badge, $initials, $approved) {
@@ -61,18 +63,20 @@ class VisitActions {
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
public function newVisit ($firstname, $lastname, $company, $reason, $intime, $signature, $siteid, $approved, $escort_signature, $escort) {
public function newVisit ($firstname, $lastname, $company, $reason, $intime, $signature, $siteid, $approved, $escort_signature, $escort, $carnum, $ssanum) {
$query = "
INSERT INTO " . Registry::DB_PRFX . "visits (" . Registry::DB_PRFX . "visits.firstname, " . Registry::DB_PRFX . "visits.lastname,
" . Registry::DB_PRFX . "visits.company, " . Registry::DB_PRFX . "visits.reason, " . Registry::DB_PRFX . "visits.intime,
" . Registry::DB_PRFX . "visits.signature, " . Registry::DB_PRFX . "visits.site_id, " . Registry::DB_PRFX . "visits.approved,
" . Registry::DB_PRFX . "visits.escort_signature, " . Registry::DB_PRFX . "visits.escort)
" . Registry::DB_PRFX . "visits.escort_signature, " . Registry::DB_PRFX . "visits.escort, " . Registry::DB_PRFX . "visits.carnum, " . Registry::DB_PRFX . "visits.ssanum)
VALUES (\"$firstname\", \"$lastname\", \"$company\", \"$reason\", \"$intime\", \"$signature\", \"$siteid\",
\"$approved\", \"$escort_signature\", \"$escort\")
\"$approved\", \"$escort_signature\", \"$escort\", \"$carnum\", \"$ssanum\")
";
$database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query);
return $count;
}
}

6
src/Database/VisitInfo.php Executable file → Normal file
View File

@@ -41,7 +41,7 @@ class VisitInfo {
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
if ($intime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime=\"$intime\" AND "; };
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id=\"$siteid\" AND "; };
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id IN (\"$siteid\") AND "; };
if ($visitid == "%") { $cond_visitid = NULL; } else { $cond_visitid = Registry::DB_PRFX . "visits.id LIKE \"$visitid\" AND "; };
if ($starttime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime BETWEEN \"$starttime\" and \"$endtime\" AND "; };
$query = "
@@ -62,7 +62,9 @@ class VisitInfo {
" . Registry::DB_PRFX . "visits.badge as visits_badge,
" . Registry::DB_PRFX . "visits.site_id as visits_site_id,
" . Registry::DB_PRFX . "visits.company as visits_company,
" . Registry::DB_PRFX . "visits.approved as visits_approved
" . Registry::DB_PRFX . "visits.approved as visits_approved,
" . Registry::DB_PRFX . "visits.carnum as visits_carnum,
" . Registry::DB_PRFX . "visits.ssanum as visits_ssanum
FROM " . Registry::DB_PRFX . "visits
WHERE " . $cond_siteid . Registry::DB_PRFX . "visits.approved>=\"$approved\" AND " . $cond_outtime . $cond_intime . Registry::DB_PRFX . "visits.id LIKE \"$visitid\"" . $cond_rowsperpage . $cond_offset;
$database = new \App\LobbySIO\Database\Connect();

View File

@@ -9,14 +9,18 @@ ACTIVEVISITS = 'Aktive Besuche'
ADDEQPT = 'Ausrüstung hinzufügen'
ADD_USER = 'Benutzer hinzufügen'
ADD_USER_DESC = 'Alle Felder sind erforderlich! Benutzername und E-Mail müssen eindeutig sein. Minimale Passwortlänge ist '
ADD_SITE = 'Ort hinzufügen'
SADMIN = 'Standortadministrator'
ADMIN = 'Administrator'
ADMINISTRATION = 'Verwaltung'
ALL = 'Alles'
APPROVE = 'Genehmigen'
APP_NAME = 'Empfangshalle Einloggen / Ausloggen'
APP_NAME = 'Einloggen / Ausloggen'
BACK = 'Zurückkehren'
BADGE = 'Abzeichen-Nummer'
BADGEINITIALS = 'Abzeichen-Nummer & Initialen'
CANCEL = 'Stornieren'
CARNUM = 'Autokennzeichen'
CHANGE = 'Wechseln'
CHOOSE = 'Wählen'
CITIZEN = 'Bürger?'
@@ -72,8 +76,10 @@ META_DESC = 'LobbySIO ist eine Touchscreen-kompatible Signatur-Pad / Anmeldeform
MIN_PASSWORD_LENGTH = 'Minimale Passwortlänge ist '
NAME = 'Vollständiger Name'
NEW = 'Neu'
NEXT = 'Nächster'
NONEAVA = 'Keiner'
NOSIGNIN = 'Keine Anmeldung'
NOSITE = 'Kein Standort ausgewählt'
NOTES = 'Anmerkungen'
NOTES_PLACEHOLDER = 'Geben Sie bei Bedarf Notizen ein'
NOT_AUTHORIZED = 'Nicht berechtigt!'
@@ -94,6 +100,7 @@ REASON = 'Grund für den Zugang zu Einrichtungen'
REASONCOMPANY = 'Firma / Grund'
REFERENCE = 'Referenz'
REFRESH = 'Aktualisieren'
REGION ='Region'
REMEQPT = 'Ausrüstung entfernen'
REPORTS = 'Berichte'
REPORTS_DESC = 'Die Dropdown-Liste kann verwendet werden, um vorkonfigurierte Berichte auszuwählen. Weitere Berichte werden gerade geschrieben.'
@@ -110,6 +117,7 @@ SIGNOUT_THANKYOU = 'Danke - Sie wurden erfolgreich abgemeldet.'
SINCE = 'seit'
SITE = 'Site'
SOFTWARE_VERSION = 'Version'
SSANUM = 'SSA-Ticketnummer'
START = 'Anfang'
STATEID = 'Staat ID'
TERMSTITLE = 'Unsere Regeln'

View File

@@ -9,14 +9,18 @@ ACTIVEVISITS = 'Active Visits'
ADDEQPT = 'Add Equipment'
ADD_USER = 'Add User'
ADD_USER_DESC = 'All fields are required! Username and email must be unique. Minimum password length is '
ADD_SITE = 'Add Site'
SADMIN = 'Site Administrator'
ADMIN = 'Administrator'
ADMINISTRATION = 'Administration'
ALL = 'All'
APPROVE = 'Approve'
APP_NAME = 'Lobby Sign-In/Sign-Out'
APP_NAME = 'Sign-In/Sign-Out'
BACK = 'Back'
BADGE = 'Badge#'
BADGEINITIALS = 'Badge & Initials'
CANCEL = 'Cancel'
CARNUM = 'Car Registration #'
CHANGE = 'Change'
CHOOSE = 'Choose'
CITIZEN = 'Citizen?'
@@ -24,9 +28,9 @@ CLOSE = 'Close'
COMPANY = 'Company'
CONFIRM = 'Confirm'
CREATED = 'Created'
CUSTSIGNIN = 'Customer Sign In'
CUSTSIGNOUT = 'Customer Sign Out'
CUST_BANNER = 'Lobby Sign-In/Sign-Out'
CUSTSIGNIN = 'Visitor Sign In'
CUSTSIGNOUT = 'Visitor Sign Out'
CUST_BANNER = 'Visitor Sign-In/Sign-Out'
DEFAULT = 'Default'
DELETE = 'Delete'
DELETE_WARNING = '********* WARNING! ********** Are you SURE you want to DELETE this user AND ALL ASSOCIATED PUNCHES!?!? There is NO UNDO!'
@@ -72,8 +76,10 @@ META_DESC = 'LobbySIO is a touchscreen-compatible signature pad/sign-in sheet we
MIN_PASSWORD_LENGTH = 'Minimum password length is '
NAME = 'Name'
NEW = 'New'
NEXT = 'Next'
NONEAVA = 'None'
NOSIGNIN = 'No sign in'
NOSITE = 'No Site Selected'
NOTES = 'Notes'
NOTES_PLACEHOLDER = 'Enter notes if needed'
NOT_AUTHORIZED = 'Not Authorized!'
@@ -94,6 +100,7 @@ REASON = 'Reason for Facility Access'
REASONCOMPANY = 'Company / Reason'
REFERENCE = 'Reference'
REFRESH = 'Refresh'
REGION ='Region'
REMEQPT = 'Remove Equipment'
REPORTS = 'Reports'
REPORTS_DESC = 'The drop-down below can be used to select pre-configured reports. Other reports are currently being written.'
@@ -110,6 +117,7 @@ SIGNOUT_THANKYOU = 'Thank you - you have been successfully signed out.'
SINCE = 'since'
SITE = 'Site'
SOFTWARE_VERSION = 'Version'
SSANUM = 'SSA Ticket #'
START = 'Start'
STATEID = 'State ID'
TERMSTITLE = 'Our Rules'

View File

@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visitas activas'
ADDEQPT = 'Agregar Equipo'
ADD_USER = 'Agregar usuario'
ADD_USER_DESC = '¡Todos los campos son obligatorios! El nombre de usuario y el correo electrónico deben ser únicos. La longitud mínima de la contraseña es '
ADD_SITE = 'Agregar sitio'
SADMIN = 'Administrador de ubicación'
ADMIN = 'Administrador'
ADMINISTRATION = 'Administración'
ALL = 'Todos'
@@ -17,6 +19,8 @@ APP_NAME = 'Lobby de inicio / cierre de sesión'
BACK = 'Inicia'
BADGE = 'Numero de placa'
BADGEINITIALS = 'Numero de placa & Sigla'
CANCEL = 'Cancelar'
CARNUM = 'Numero de registro del carro'
CHANGE = 'Cambiar'
CHOOSE = 'Por favor seleccione'
CITIZEN = 'Ciudadano de estados unidos?'
@@ -72,8 +76,10 @@ META_DESC = 'LobbySIO es una aplicación web compatible con pantalla táctil com
MIN_PASSWORD_LENGTH = 'La longitud mínima de la contraseña es '
NAME = 'Nombre'
NEW = 'Nuevo'
NEXT = 'Siguiente'
NONEAVA = 'Nada'
NOSIGNIN = 'No completó'
NOSITE = 'Ningún sitio seleccionado'
NOTES = 'Notas'
NOTES_PLACEHOLDER = 'Introduce notas si es necesario'
NOT_AUTHORIZED = '¡No autorizado!'
@@ -94,6 +100,7 @@ REASON = 'Razón para el acceso a las instalaciones'
REASONCOMPANY = 'Empresa / Razón'
REFERENCE = 'Referencia'
REFRESH = 'Recargar'
REGION ='Región'
REMEQPT = 'Llevar Equipo'
REPORTS = 'Informes'
REPORTS_DESC = 'El menú desplegable a continuación se puede utilizar para seleccionar informes preconfigurados. Otros informes se están escribiendo actualmente.'
@@ -110,6 +117,7 @@ SIGNOUT_THANKYOU = 'Gracias, te has desconectado.'
SINCE = 'desde'
SITE = 'Sitio'
SOFTWARE_VERSION = 'Versión del software'
SSANUM = 'Número de boleto de la SSA'
START = 'Comienzo'
STATEID = 'Identificación del estado'
TERMSTITLE = 'Nuestras reglas'

View File

@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visites actives'
ADDEQPT = 'Ajouter un équipement'
ADD_USER = 'Ajouter un utilisateur'
ADD_USER_DESC = 'Tous les champs sont requis! Le nom d&#39;utilisateur et l&#39;adresse e-mail doivent être uniques. La longueur minimale du mot de passe est '
ADD_SITE = 'Ajouter un site'
SADMIN = 'Administrateur d&#39;emplacement'
ADMIN = 'Administrateur'
ADMINISTRATION = 'Administration'
ALL = 'Tout'
@@ -17,6 +19,8 @@ APP_NAME = 'Vestibule register/se désinscrire'
BACK = 'Retour'
BADGE = 'Numéro de badge'
BADGEINITIALS = 'Numéro de badge & Initiales'
CANCEL = 'Annuler'
CARNUM = 'Numéro d&#39;immatriculation'
CHANGE = 'Changement'
CHOOSE = 'Choisir'
CITIZEN = 'Citoyen?'
@@ -72,8 +76,10 @@ META_DESC = 'LobbySIO est une application Web pour tablette de signature / feuil
MIN_PASSWORD_LENGTH = 'La longueur minimale du mot de passe est '
NAME = 'Nom complet'
NEW = 'Nouveau'
NEXT = 'Suivant'
NONEAVA = 'Aucun'
NOSIGNIN = 'Pas de connexion'
NOSITE = 'Aucun site sélectionné'
NOTES = 'Notes'
NOTES_PLACEHOLDER = 'Entrez des notes si nécessaire'
NOT_AUTHORIZED = 'Pas autorisé!'
@@ -94,6 +100,7 @@ REASON = 'Raison de laccès aux installations'
REASONCOMPANY = 'Organisation / Raison'
REFERENCE = 'Reference'
REFRESH = 'Actualiser'
REGION ='Région'
REMEQPT = 'Remove Equipment'
REPORTS = 'Rapports'
REPORTS_DESC = 'Le menu déroulant ci-dessous peut être utilisé pour sélectionner des rapports préconfigurés. D&#39;autres rapports sont en cours de rédaction.'
@@ -110,6 +117,7 @@ SIGNOUT_THANKYOU = 'Merci - vous avez été déconnecté avec succès.'
SINCE = 'depuis'
SITE = 'Site'
SOFTWARE_VERSION = 'Version'
SSANUM = 'Numéro de billet SSA'
START = 'Début'
STATEID = 'State ID'
TERMSTITLE = 'Nos règles'

View File

@@ -29,7 +29,7 @@ class StaticFunctions {
public function getVersion ($app_disp_lang) {
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage();
echo $transLang['SOFTWARE_VERSION'] . ': lobbysio_v0.15-beta';
echo $transLang['SOFTWARE_VERSION'] . ': lobbysio_v0.18-beta';
}
public function getUTC () {

294
users.php
View File

@@ -17,38 +17,152 @@
* 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(); // CLASSES
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($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE FUNCTION
$app_current_pageicon = '<i class="fas fa-list"></i> '; // PAGE ICON
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
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();
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-list"></i> ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?>
<!-- CONTENT START -->
<?php if (isset($session_user)) { if($session_user["0"]["users_usertype"] !== "ADMIN") { header("Location: index.php"); ?><h2 class="content-subhead"><?php echo $transLang['NOT_AUTHORIZED']; ?></h2><?php }; }; ?>
<?php
// delete user only if submitted by button
if (!empty($_POST['deluser'])) {
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
$deleteid = (int) $_POST['deleteid'];
echo $Users->deleteUser($deleteid);
echo "user deleted!";
<?php if (!empty($_POST['edituser'])): // NEW SITE
$edituser = $Users->getUserInfo($_POST['deleteid'], "0", "0")
//$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
//header('Location: ' . $_SERVER['PHP_SELF']);
?>
<!-- USER EDIT START -->
<div class="container">
<div class="row">
<div class="col-sm">
<h2><?php echo $app_current_pageicon . $transLang['EDIT_PROFILE']; ?></h2>
</div>
</div>
<form class="form-inline my-2 my-lg-0" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset id="editor">
<div class="form-group">
<div class="row">
<div class="col-sm">
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $edituser["0"]["users_firstname"]; ?>" required />
</div>
<div class="col-sm">
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $edituser["0"]["users_lastname"]; ?>" required />
</div>
<div class="col-sm">
<input type="text" class="form-control" id="username" name="username" value="<?php echo $edituser["0"]["users_username"]; ?>" required />
</div>
<div class="col-sm">
<input type="text" class="form-control" id="email" name="email" value="<?php echo $edituser["0"]["users_email"]; ?>" />
</div>
<div class="col-sm">
<select class="custom-select" id="usertype" aria-label="<?php echo $transLang['ACCESS_LEVEL']; ?>" name="usertype" required>
<?php foreach($Users->getUserTypeInfo("%") as $row): ?>
<option value="<?php echo $row['usertypes_id']; ?>"<?php if ($row['usertypes_id']==$edituser["0"]["users_usertypeid"]) { echo " selected"; } ?>><?php echo $transLang[$row['usertypes_name']]; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="row">
<div class="col-sm">
<?php print_r($SiteInfo->getSite("0", "0", "0", "0"));
// 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"; }
?>
<select id="sitepermissions" name="sitepermissions" class="custom-select" multiple size="5">
<?php foreach($SiteInfo->getSite("0", "0", "0", "0") as $row): ?>
<option value="<?php echo $row['sites_id']; ?>"<?php if ($row['users_sites_users_id']==$edituser["0"]["users_id"]) { echo " selected"; } ?>><?php echo $row['sites_name']; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="row">
<div class="col-sm">
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="editusercomplete"><i class="fa fa-user-plus"></i> <?php echo $transLang['SAVE']; ?></button>
</div>
</div>
</div>
</fieldset>
</form>
</div>
<?php
$minpasslength = $StaticFunctions->getMinPass();
?>
<!-- USER EDIT END -->
<?php
endif;
?>
<?php // POST ACTIONS
if (!empty($_POST['newsite'])): // NEW SITE
$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
if (!empty($_POST['newuser'])): // NEW USER
require_once("src/Misc/PasswordHash.php");
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
$existing = $Users->checkUser($_POST['username'], $email);
if ($existing):
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
endif;
endif;
if (!empty($_POST['newuser']) && empty($errors)):
$hasher = new PasswordHash(8, FALSE);
$password = $hasher->HashPassword($_POST['password']);
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
if (!empty($_POST['deluser'])) {
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
$deleteid = (int) $_POST['deleteid'];
echo $Users->deleteUser($deleteid);
echo "user deleted!";
header('Location: ' . $_SERVER['PHP_SELF']);
}
}
}
// Set up pagination
$page_num = 1;
@@ -66,7 +180,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<!-- USER MGMT START -->
<div class="container">
<div class="row">
<div class="col-sm">
@@ -86,7 +200,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<tbody>
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
<tr>
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="button-error pure-button" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="btn btn-primary btn-sm" id="edituser" name="edituser" value="edituser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; if ($row['users_username'] == "KIOSK"): echo "disabled"; endif; ?>><i class="fa fa-edit"></i> </button><button class="btn btn-danger btn-sm" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; if ($row['users_username'] == "KIOSK"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -113,31 +227,6 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p>
</div>
</div>
<?php
// new user pw check
require_once("src/Misc/PasswordHash.php");
if (!empty($_POST['newuser'])):
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
$existing = $Users->checkUser($_POST['username'], $email);
if ($existing):
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
endif;
endif;
if (!empty($_POST['newuser']) && empty($errors)):
$hasher = new PasswordHash(8, FALSE);
$password = $hasher->HashPassword($_POST['password']);
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
?>
<fieldset id="registration">
<div class="form-group">
<div class="row">
@@ -184,27 +273,55 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</div>
</div>
<!-- MODAL END -->
<!-- USER MGMT END -->
<?php
// delete user only if submitted by button
if (!empty($_POST['delsite'])) {
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
$deleteid = (int) $_POST['deleteid'];
echo $SiteInfo->deleteSite($deleteid);
echo "site deleted!";
header('Location: ' . $_SERVER['PHP_SELF']);
}
}
// Set up pagination
$page_num1 = 1;
if(!empty($_GET['pnum1'])):
$page_num1 = filter_input(INPUT_GET, 'pnum1', FILTER_VALIDATE_INT);
if(false === $page_num1):
$page_num1 = 1;
endif;
endif;
$offset1 = ($page_num1 - 1) * $StaticFunctions->getPageRows();
$row_count1 = count($SiteInfo->getSite("0", "0", "0", "0"));
$page_count1 = 0;
if (0 === $row_count1): else: $page_count1 = (int)ceil($row_count1 / $StaticFunctions->getPageRows()); if($page_num1 > $page_count1): $page_num1 = 1; endif; endif;
?>
<!-- SITE MGMT START -->
<div class="container">
<div class="row">
<div class="col-sm">
<h2><?php echo $app_current_pageicon . $transLang['USERS']; ?></h2>
<h2><?php echo $app_current_pageicon . $transLang['SITE']; ?></h2>
</div>
<div class="col-sm">
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#addUserModal"><?php echo $transLang['ADD_USER']; ?></button>
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#addSiteModal"><?php echo $transLang['ADD_SITE']; ?></button>
</div>
</div>
<?php echo '<ul class="pagination pagination-sm"><li class="page-item disabled"><a class="page-link" href="#" tabindex="-1">' . $transLang['PAGE'] . '</a></li>'; for ($i = 1; $i <= $page_count; $i++): echo '<li class="page-item'; if ($i === $page_num): echo ' active'; else: echo ' '; endif; echo '"><a class="page-link" href="' . $_SERVER['PHP_SELF'] . '?pnum=' . $i . '">' . $i . '</a></li>'; endfor; echo '</ul>'; ?>
<?php echo '<ul class="pagination pagination-sm"><li class="page-item disabled"><a class="page-link" href="#" tabindex="-1">' . $transLang['PAGE'] . '</a></li>'; for ($i1 = 1; $i1 <= $page_count1; $i1++): echo '<li class="page-item'; if ($i1 === $page_num1): echo ' active'; else: echo ' '; endif; echo '"><a class="page-link" href="' . $_SERVER['PHP_SELF'] . '?pnum1=' . $i1 . '">' . $i1 . '</a></li>'; endfor; echo '</ul>'; ?>
<table class="table">
<thead class="thead-dark">
<tr>
<th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['USERNAME']; ?></th><th><?php echo $transLang['EMAIL']; ?></th><th><?php echo $transLang['CREATED']; ?></th><th><?php echo $transLang['USERTYPE']; ?></th><th><?php echo $transLang['ACTIONS']; ?></th>
<th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['TIMEZONE']; ?></th><th><?php echo $transLang['REGION']; ?></th><th><?php echo $transLang['ACTIONS']; ?></th>
</tr>
</thead>
<tbody>
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
<?php foreach($SiteInfo->getSite("0", "0", $StaticFunctions->getPageRows(), $offset1) as $row1): ?>
<tr>
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="button-error pure-button" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
<td><?php echo $row1['sites_name']; ?></td><td><?php echo $row1['sites_timezone']; ?></td><td><?php echo $row1['sites_region']; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row1['sites_id']; ?>" /><button class="btn btn-danger btn-sm" id="deluser" name="delsite" value="delsite" type="submit"><i class="fa fa-trash"></i> </button></form></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -215,11 +332,11 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
?>
<!-- MODAL START -->
<div class="modal fade" id="addUserModal" tabindex="-1" role="dialog" aria-labelledby="Site" aria-hidden="true">
<div class="modal fade" id="addSiteModal" tabindex="-1" role="dialog" aria-labelledby="Site" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="AddUser"><?php echo $transLang['ADD_USER']; ?></h5>
<h5 class="modal-title" id="AddSite"><?php echo $transLang['ADD_SITE']; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@@ -228,69 +345,33 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<form class="form-inline my-2 my-lg-0" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div class="row">
<div class="col-sm">
<p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p>
<p class="lead"><?php echo $transLang['ADD_SITE']; ?></p>
</div>
</div>
<?php
// new user pw check
require_once("src/Misc/PasswordHash.php");
if (!empty($_POST['newuser'])):
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
$existing = $Users->checkUser($_POST['username'], $email);
if ($existing):
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
endif;
endif;
if (!empty($_POST['newuser']) && empty($errors)):
$hasher = new PasswordHash(8, FALSE);
$password = $hasher->HashPassword($_POST['password']);
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
?>
<fieldset id="registration">
<div class="form-group">
<div class="row">
<div class="col-sm">
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" required />
<input type="text" class="form-control" id="sitename" name="sitename" placeholder="Site Name" required />
</div>
<div class="col-sm">
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" required />
<select class="form-control" id="timezone" name="timezone" required>
<option value=""><?php echo $transLang['TIMEZONE']; ?></option>
<?php foreach(DateTimeZone::listIdentifiers(DateTimeZone::ALL) as $row2) { ?><option><?php echo $row2; ?></option><?php }; ?>
</select>
</div>
</div>
<div class="row">
<div class="col-sm">
<input type="text" class="form-control" id="username" name="username" placeholder="Username" required />
</div>
<div class="col-sm">
<input type="text" class="form-control" id="email" name="email" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="col-sm">
<input type="password" class="form-control" id="password" name="password" placeholder="Password" required />
</div>
<div class="col-sm">
<input type="password" class="form-control" id="password_confirm" name="password_confirm" placeholder="Confirm Password" required />
</div>
</div>
<div class="row">
<div class="col-sm">
<select class="custom-select" id="usertype" aria-label="<?php echo $transLang['ACCESS_LEVEL']; ?>" name="usertype" required>
<option value="" selected><?php echo $transLang['CHOOSE']; ?> <?php echo $transLang['ACCESS_LEVEL']; ?></option><?php foreach($Users->getUserTypeInfo("%") as $row): ?>
<option value="<?php echo $row['usertypes_id']; ?>"><?php echo $transLang[$row['usertypes_name']]; ?></option><?php endforeach; ?>
<select class="form-control" id="region" name="region" required>
<option value=""><?php echo $transLang['REGION']; ?></option>
<option>CAN</option>
<option>EMEA</option>
<option>US</option>
</select>
</div>
<div class="col-sm">
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="newuser"><i class="fa fa-user-plus"></i> <?php echo $transLang['ADD_USER']; ?></button>
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="newsite"><i class="fa fa-user-plus"></i> <?php echo $transLang['ADD_SITE']; ?></button>
</div>
</div>
</div>
@@ -302,6 +383,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</div>
</div>
<!-- MODAL END -->
<!-- SITE MGMT END -->
<!-- CONTENT END -->