13 Commits

Author SHA1 Message Date
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
21 changed files with 621 additions and 447 deletions

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

@@ -22,103 +22,76 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */; /*!40101 SET NAMES utf8mb4 */;
-- -------------------------------------------------------- DROP TABLE IF EXISTS `lsio_idtypes`;
--
-- Table structure for table `lsio_idtypes`
--
CREATE TABLE `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' `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_idtypes`
--
INSERT INTO `lsio_idtypes` (`id`, `name`) VALUES INSERT INTO `lsio_idtypes` (`id`, `name`) VALUES
(3, 'PASSPORT'), (3, 'PASSPORT'),
(2, 'STATEID'), (2, 'STATEID'),
(1, 'UNAVAIL'); (1, 'UNAVAIL');
-- -------------------------------------------------------- -- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_sites`;
--
-- Table structure for table `lsio_sites`
--
CREATE TABLE `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', `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; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`, `region`) VALUES
-- (1, 'NOSITE', 'UTC', 'NO'),
-- Dumping data for table `lsio_sites` (2, 'Default Site', 'America/New_York', 'US');
--
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`) VALUES
(1, 'NOSITE', 'UTC'),
(2, 'Default', 'America/New_York');
-- -------------------------------------------------------- -- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users`;
--
-- Table structure for table `lsio_users`
--
CREATE TABLE `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, `username` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`password` varchar(60) 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, `email` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`created` datetime NOT NULL, `created` datetime NOT NULL,
`firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, `firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`lastname` 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 `timezone` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; ) 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 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, '');
-- -------------------------------------------------------- -- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users_sites`;
-- CREATE TABLE `lsio_users_sites` (
-- Table structure for table `lsio_usertypes` `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` ( 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' `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_usertypes`
--
INSERT INTO `lsio_usertypes` (`id`, `name`) VALUES INSERT INTO `lsio_usertypes` (`id`, `name`) VALUES
(1, 'ADMIN'), (1, 'ADMIN'),
(3, 'KIOSK'), (3, 'KIOSK'),
(4, 'SADMIN'),
(2, 'USER'); (2, 'USER');
-- -------------------------------------------------------- -- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visits`;
--
-- Table structure for table `lsio_visits`
--
CREATE TABLE `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, `firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, `lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`company` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL, `company` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
@@ -128,30 +101,21 @@ CREATE TABLE `lsio_visits` (
`signature` blob, `signature` blob,
`escort_signature` blob, `escort_signature` blob,
`citizen` tinyint(3) UNSIGNED DEFAULT NULL, `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, `id_checked` tinyint(3) UNSIGNED DEFAULT NULL,
`initials` varchar(5) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, `initials` varchar(5) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`badge` varchar(15) 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, `notes` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`site_id` tinyint(3) UNSIGNED DEFAULT NULL, `site_id` int(10) UNSIGNED DEFAULT NULL,
`reason` tinyint(3) UNSIGNED DEFAULT NULL, `reason` int(10) UNSIGNED DEFAULT NULL,
`approved` tinyint(4) DEFAULT '1' COMMENT '0 void, 1 unapproved, 2 approved' `approved` tinyint(4) DEFAULT '1' COMMENT '0 void, 1 unapproved, 2 approved'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visittypes`;
--
-- Table structure for table `lsio_visittypes`
--
CREATE TABLE `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' `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Dumping data for table `lsio_visittypes`
--
INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(2, 'ADDEQPT'), (2, 'ADDEQPT'),
(7, 'INSTHARD'), (7, 'INSTHARD'),
@@ -163,45 +127,25 @@ INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(3, 'REMEQPT'), (3, 'REMEQPT'),
(6, 'TESTING'), (6, 'TESTING'),
(5, 'TOUR'); (5, 'TOUR');
-- --------------------------------------------------------
--
-- Indexes for dumped tables
--
--
-- Indexes for table `lsio_idtypes`
--
ALTER TABLE `lsio_idtypes` ALTER TABLE `lsio_idtypes`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`); ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_sites`
--
ALTER TABLE `lsio_sites` ALTER TABLE `lsio_sites`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`); ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_users`
--
ALTER TABLE `lsio_users` ALTER TABLE `lsio_users`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD KEY `users_ibfk_1` (`usertype`); ADD KEY `users_ibfk_1` (`usertype`);
ALTER TABLE `lsio_users_sites`
-- ADD UNIQUE KEY `user_site_perm` (`sites_id`,`users_id`) USING BTREE,
-- Indexes for table `lsio_usertypes` ADD KEY `users_id` (`users_id`);
--
ALTER TABLE `lsio_usertypes` ALTER TABLE `lsio_usertypes`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`); ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `lsio_visits`
--
ALTER TABLE `lsio_visits` ALTER TABLE `lsio_visits`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD KEY `site_id` (`site_id`), ADD KEY `site_id` (`site_id`),
@@ -209,49 +153,30 @@ ALTER TABLE `lsio_visits`
ADD KEY `id_checked` (`id_checked`), ADD KEY `id_checked` (`id_checked`),
ADD KEY `citizen` (`citizen`), ADD KEY `citizen` (`citizen`),
ADD KEY `id_type` (`id_type`); ADD KEY `id_type` (`id_type`);
--
-- Indexes for table `lsio_visittypes`
--
ALTER TABLE `lsio_visittypes` ALTER TABLE `lsio_visittypes`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`); ADD UNIQUE KEY `name` (`name`);
-- --------------------------------------------------------
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `lsio_idtypes`
--
ALTER TABLE `lsio_idtypes` ALTER TABLE `lsio_idtypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=4; MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `lsio_sites`
--
ALTER TABLE `lsio_sites` ALTER TABLE `lsio_sites`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=25; MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `lsio_users`
--
ALTER TABLE `lsio_users` ALTER TABLE `lsio_users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35; MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `lsio_usertypes`
--
ALTER TABLE `lsio_usertypes` ALTER TABLE `lsio_usertypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=4; MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `lsio_visits`
--
ALTER TABLE `lsio_visits` ALTER TABLE `lsio_visits`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59; MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `lsio_visittypes`
--
ALTER TABLE `lsio_visittypes` ALTER TABLE `lsio_visittypes`
MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=11; MODIFY `id` int(10) 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 */; ALTER TABLE `lsio_users`
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 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 <?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(); $SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users(); $Users = new \App\LobbySIO\Database\Users();
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
ob_start(); // OUTPUT BUFFER if (isset($session_user)) { // GET UID OR SET TO KIOSK
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 $uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$session_status = $StaticFunctions->getSessionStatus(); // SET A STATUS $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(); $defaulttimezone = $StaticFunctions->getDefaultTZ();
date_default_timezone_set('UTC'); // DEFAULT TO UTC date_default_timezone_set('UTC'); // DEFAULT TO UTC
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING 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 $timezone = $SiteInfo->getSite($siteid, "0", "0", "0")[0]["sites_timezone"]; // GET TIMEZONE FROM SITE ID
$app_disp_lang=$StaticFunctions->getDefaultLanguage(); $timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
} 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
$timeplus->setTimezone(new DateTimeZone("$timezone")); $timeplus->setTimezone(new DateTimeZone("$timezone"));
$timenow = $timeplus->format('Y-m-d H:i:s'); $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> <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>
<ul class="navbar-nav mr-sm-2"> <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 endif; ?>
<?php if ($session_status == true): ?> <?php if ($session_status == true): ?>
<!-- MENU FOR ALL LOGGED IN - BOTTOM END --> <!-- MENU FOR ALL LOGGED IN - BOTTOM END -->
</ul> </ul>
<ul class="navbar-nav mr-sm-2"> <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; ?> <?php endif; ?>
</ul>
<ul class="form-control-sm">
<form action="changelang.php" method="post" name="changelang" class="changelang"> <form action="changelang.php" method="post" name="changelang" class="changelang">
<div class="input-group mb-3"> <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){ <?php foreach(glob('src/Language/*.ini') as $file){
if(!is_dir($file)) { $filename=basename(preg_replace('/\.[^.]+$/','',preg_replace('/\.[^.]+$/','',$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> <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-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
@@ -136,12 +159,11 @@
<form class="form-inline my-2 my-lg-0" action="changesite.php" method="post"> <form class="form-inline my-2 my-lg-0" action="changesite.php" method="post">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <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> </div>
<select class="custom-select" id="site" aria-label="Site" name="site"> <select class="custom-select" id="site" aria-label="Site" name="site" required>
<option selected><?php echo $transLang['CHOOSE']; ?></option> <?php foreach($SiteInfo->getSite("0", $uid, "0", "0") as $row): ?>
<?php foreach($SiteInfo->getSiteInfo("%") 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>
<option value="<?php echo $row['sites_id']; ?>"><?php echo $row['sites_name']; ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<input class="btn" type="submit" value="<?php echo $transLang['SAVE']; ?>" /> <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/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$Users = new \App\LobbySIO\Database\Users();
$SiteInfo = new \App\LobbySIO\Database\SiteInfo(); $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(); $IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo(); $VisitInfo = new \App\LobbySIO\Database\VisitInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions(); $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']; }; $app_current_pagename = $transLang['HOME']; // PAGE SETUP
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $app_current_pageicon = '<i class="fas fa-home"></i> ';
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR require_once("inc/header.inc.php");
$app_current_pagename = $transLang['HOME']; // PAGE FUNCTION if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
$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
?> ?>
<!-- GUEST CONTENT START --> <!-- GUEST CONTENT START -->
@@ -129,7 +141,6 @@
?> ?>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
@@ -143,7 +154,7 @@
<table class="table"> <table class="table">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <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> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -152,6 +163,8 @@
$timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC')); $timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC'));
$timein->setTimezone(new DateTimeZone("$timezone")); $timein->setTimezone(new DateTimeZone("$timezone"));
$timein_disp = $timein->format('Y-m-d H:i:s'); $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) { ?> <?php if($row['visits_approved']==2) { ?>
<tr class="alert alert-success"> <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> <input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked" disabled>
<?php }; ?> <?php }; ?>
<label class="form-check-label" for="id_checked"><?php echo $transLang['ID_CHECKED']; ?></label><br> <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> <input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" checked disabled>
<?php } else { ?> <?php } else { ?>
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" disabled> <input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" disabled>
<?php }; ?> <?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> <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> </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> <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> <div>
@@ -199,16 +217,21 @@
<option value="<?php echo $row['idtypes_id']; ?>"><?php echo $transLang[$row['idtypes_name']]; ?></option><?php endforeach; ?> <option value="<?php echo $row['idtypes_id']; ?>"><?php echo $transLang[$row['idtypes_name']]; ?></option><?php endforeach; ?>
</select> </select>
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div> <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> <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"> <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> <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<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['BADGE']; ?>" autofocus maxlength="15"> <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> <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"> <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> <div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
</td> </td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<?php }; ?>
<td> <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> <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> </td>

View File

@@ -17,23 +17,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo(); $SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users(); $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']; }; if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR if (isset($session_user)) { // GET UID OR SET TO KIOSK
$app_current_pagename = $transLang['LOGIN']; // PAGE FUNCTION $uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON $app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
require_once("inc/header.inc.php"); // SHOW HEADER if(!isset($app_disp_lang)) {
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS $app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
header('Location: index.php'); // ELSE HOME $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 { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->
@@ -60,9 +72,9 @@ endif;
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm"> <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->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; ?>
<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->getSite($siteid, $uid, "0", "0")[0]["sites_timezone"]; ?>
<br><b><?php echo $transLang['TIMEZONE']; ?>:</b> <?php echo $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"]; ?></p> <br><b><?php echo $transLang['REGION']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"]; ?></p>
</div> </div>
<div class="col-sm"> <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> <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/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; }; $SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $Users = new \App\LobbySIO\Database\Users();
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$app_current_pagename = $transLang['LOGOUT']; // PAGE FUNCTION $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
$app_current_pageicon = '<i class="fas fa-sign-out"></i> '; // PAGE ICON if (isset($session_user)) { // GET UID OR SET TO KIOSK
require_once("inc/header.inc.php"); // SHOW HEADER $uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS $app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
echo $StaticFunctions->killSession(); // ELSE DIE 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 { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->

View File

@@ -17,22 +17,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users(); $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']; }; if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR if (isset($session_user)) { // GET UID OR SET TO KIOSK
$app_current_pagename = $transLang['ACCOUNT']; // PAGE FUNCTION $uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';// PAGE ICON $app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
require_once("inc/header.inc.php"); // SHOW HEADER if(!isset($app_disp_lang)) {
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS $app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
echo $StaticFunctions->killSession(); // ELSE DIE $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 { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->

View File

@@ -17,25 +17,38 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo(); $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(); $VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo();
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo(); $IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo(); $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']; }; $app_current_pagename = $transLang['REPORTS']; // PAGE SETUP
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $app_current_pageicon = '<i class="fas fa-chart-pie"></i> ';
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR require_once("inc/header.inc.php");
$app_current_pagename = $transLang['REPORTS']; // PAGE FUNCTION if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> '; // PAGE ICON echo $StaticFunctions->killSession(); // ELSE DIE
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->
@@ -70,8 +83,10 @@
</div> </div>
<?php if (isset($_POST['repsite'])) { $currentrepsite = $_POST['repsite']; } else { $currentrepsite = "0"; }; ?> <?php if (isset($_POST['repsite'])) { $currentrepsite = $_POST['repsite']; } else { $currentrepsite = "0"; }; ?>
<select name="repsite" class="form-control"> <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> <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> <option value="<?php echo $row['sites_id']; ?>"<?php if ($currentrepsite == $row['sites_id']) {echo " selected";}; ?>><?php echo $row['sites_name']; ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@@ -84,7 +99,7 @@
<div class="input-group-prepend " data-target=".datetimepicker-1" data-toggle="datetimepicker"> <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 class="input-group-text "><i class="fa fa-calendar"></i>&nbsp <?php echo $transLang['START']; ?></div>
</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> </div>
<div class='col-sm'> <div class='col-sm'>
@@ -92,17 +107,17 @@
<div class="input-group-prepend" data-target=".datetimepicker-2" data-toggle="datetimepicker"> <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 class="input-group-text"><i class="fa fa-calendar"></i>&nbsp <?php echo $transLang['END']; ?></div>
</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>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(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>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(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> </script>
</div> </div>
@@ -118,11 +133,11 @@
<?php if ($_POST['reporttype'] == "Default"): ?> <?php if ($_POST['reporttype'] == "Default"): ?>
<div class="container-fluid"> <div class="container-fluid">
<table id="report" class="table table-striped table-bordered"> <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> <tbody>
<?php <?php
$approval = "2"; $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): foreach ($VisitInfo->getVisitInfo($selsite, $approval, "%", "%", "%", $_POST['starttime'], $_POST['endtime'], "%", "%") as $row):
$timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC')); $timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC'));
$timeout = new DateTime($row['visits_outtime'], new DateTimeZone('UTC')); $timeout = new DateTime($row['visits_outtime'], new DateTimeZone('UTC'));
@@ -130,20 +145,26 @@
$timeout->setTimezone(new DateTimeZone("$timezone")); $timeout->setTimezone(new DateTimeZone("$timezone"));
$timein_disp = $timein->format('Y-m-d H:i:s'); $timein_disp = $timein->format('Y-m-d H:i:s');
$timeout_disp = $timeout->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> <tr>
<td><?php echo $timein_disp; ?></td> <td><?php echo $timein_disp; ?></td>
<td><?php if (!empty($row['visits_outtime'])) {echo $timeout_disp; } else {echo $transLang['IN'];}; ?></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 echo $SiteInfo->getSite($row['visits_site_id'], $uid, "0", "0")[0]["sites_name"]; ?></td>
<td><?php echo $row['visits_company']; ?></td> <td><?php echo $row['visits_company']; ?></td>
<td><?php echo $transLang[$VisitTypeInfo->getVisitTypeInfo($row['visits_reason'])[0]['visittypes_name']]; ?></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 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 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_badge']; ?></td>
<td><?php echo $row['visits_initials']; ?></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 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> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>

View File

@@ -17,23 +17,36 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo(); $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(); $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']; }; $app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR require_once("inc/header.inc.php");
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON header('Location: index.php'); // ELSE HOME
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->
@@ -55,6 +68,26 @@
</div> </div>
</div> </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="row">
<div class="col-sm"> <div class="col-sm">
<div class="input-group mb-3"> <div class="input-group mb-3">
@@ -108,7 +141,7 @@
</div> </div>
<input type="hidden" name="v_signature" id="v_signature" required /> <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="siteid" id="siteid" value="<?php echo $siteid; ?>" />
<p><?php echo $transLang['ACKNOWLEDGEMENT']; ?><p> <?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><?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> <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['SIGNIN']; ?></button>

View File

@@ -17,29 +17,44 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo(); $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(); $VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions(); $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']; }; $app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $app_current_pageicon = '<i class="fas fa-file-signature"></i> ';
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR require_once("inc/header.inc.php");
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
$app_current_pageicon = '<i class="fas fa-file-signature"></i> ';// PAGE ICON header('Location: index.php'); // ELSE HOME
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->
<?php if (!empty($_POST)) { // PROCESS POST <?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="container">
<div class="row"> <div class="row">
@@ -62,8 +77,8 @@
</table> </table>
</div> </div>
<div class="row"> <div class="row">
<h4><?php echo $transLang['ACKNOWLEDGEMENT']; ?></h4> <?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { echo "<p>" . $transLang['ACKNOWLEDGEMENT'] . "</p>"; } ?>
<h5><?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?></h5> <p><?php echo $transLang['GDPR_TEXT']; ?><p>
</div> </div>
</div> </div>
<?php } else { // EXIT IF NO POST <?php } else { // EXIT IF NO POST

View File

@@ -17,23 +17,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $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(); $VisitInfo = new \App\LobbySIO\Database\VisitInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions(); $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']; }; $app_current_pagename = $transLang['SIGNOUT']; // PAGE SETUP
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR require_once("inc/header.inc.php");
$app_current_pagename = $transLang['SIGNOUT']; // PAGE FUNCTION if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
$app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';// PAGE ICON header('Location: index.php'); // ELSE HOME
require_once("inc/header.inc.php"); // SHOW HEADER
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
header('Location: index.php'); // ELSE HOME
} else { ?> } else { ?>
<!-- CONTENT START --> <!-- CONTENT START -->

View File

@@ -37,7 +37,7 @@ class Registry { const
DB_PRFX = 'lsio_', // DB table prefix DB_PRFX = 'lsio_', // DB table prefix
ORGANIZATION = 'Widgets, Inc', // Organization name ORGANIZATION = 'Widgets, Inc', // Organization name
DEFAULTLANGUAGE = 'en', // Default language - make sure a translation file exists 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 MINPASS = '8', // Minimum password length
DEFAULTTZ = 'America/New_York' // DEFAULT TIME ZONE DEFAULTTZ = 'America/New_York' // DEFAULT TIME ZONE
;} ;}

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

@@ -27,29 +27,60 @@ use App\LobbySIO\Config\Registry;
*/ */
class SiteInfo { 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 = " $query = "
SELECT SELECT
" . Registry::DB_PRFX . "sites.id as sites_id, " . Registry::DB_PRFX . "sites.id as sites_id,
" . Registry::DB_PRFX . "sites.name as sites_name, " . Registry::DB_PRFX . "sites.name as sites_name,
" . Registry::DB_PRFX . "sites.timezone as sites_timezone " . Registry::DB_PRFX . "sites.region as sites_region,
FROM " . Registry::DB_PRFX . "sites " . Registry::DB_PRFX . "sites.timezone as sites_timezone
WHERE " . Registry::DB_PRFX . "sites.id LIKE \"$siteid\""; 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(); $database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query); $rows = $database->getQuery($query);
return $rows; return $rows;
} }
public function getSiteName ($siteid) { public function deleteSite ($siteid) {
$query = " $query = "
SELECT DELETE FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.id=\"$siteid\"
" . 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";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query); $count = $database->runQuery($query);
return $rows[0]["sites_name"]; 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 * @author josh.north
*/ */
class Users { 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) { public function getUserInfo($userid, $rowsperpage, $offset) {
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; }; if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; }; if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
@@ -86,6 +86,7 @@ class Users {
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $count = $database->runQuery($query);
return $count;
} }
public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) { public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) {
@@ -102,6 +103,7 @@ class Users {
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $count = $database->runQuery($query);
return $count;
} }
public function getUserType ($usertypeid){ public function getUserType ($usertypeid){
@@ -122,6 +124,7 @@ class Users {
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $count = $database->runQuery($query);
return $count;
} }
public function getUserTypeInfo ($usertypeid) { 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(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $count = $database->runQuery($query);
return $count;
} }
public function voidVisit ($visitid, $approved) { public function voidVisit ($visitid, $approved) {
@@ -45,6 +46,7 @@ class VisitActions {
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $count = $database->runQuery($query);
return $count;
} }
public function approveVisit ($approvevisit, $id_type, $id_checked, $citizen, $badge, $initials, $approved) { public function approveVisit ($approvevisit, $id_type, $id_checked, $citizen, $badge, $initials, $approved) {
@@ -61,18 +63,20 @@ class VisitActions {
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $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 = " $query = "
INSERT INTO " . Registry::DB_PRFX . "visits (" . Registry::DB_PRFX . "visits.firstname, " . Registry::DB_PRFX . "visits.lastname, 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.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.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\", VALUES (\"$firstname\", \"$lastname\", \"$company\", \"$reason\", \"$intime\", \"$signature\", \"$siteid\",
\"$approved\", \"$escort_signature\", \"$escort\") \"$approved\", \"$escort_signature\", \"$escort\", \"$carnum\", \"$ssanum\")
"; ";
$database = new \App\LobbySIO\Database\Connect(); $database = new \App\LobbySIO\Database\Connect();
$count = $database->runQuery($query); $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 ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; }; 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 ($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 ($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 "; }; if ($starttime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime BETWEEN \"$starttime\" and \"$endtime\" AND "; };
$query = " $query = "
@@ -62,7 +62,9 @@ class VisitInfo {
" . Registry::DB_PRFX . "visits.badge as visits_badge, " . Registry::DB_PRFX . "visits.badge as visits_badge,
" . Registry::DB_PRFX . "visits.site_id as visits_site_id, " . Registry::DB_PRFX . "visits.site_id as visits_site_id,
" . Registry::DB_PRFX . "visits.company as visits_company, " . 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 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; 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(); $database = new \App\LobbySIO\Database\Connect();

View File

@@ -9,14 +9,17 @@ ACTIVEVISITS = 'Aktive Besuche'
ADDEQPT = 'Ausrüstung hinzufügen' ADDEQPT = 'Ausrüstung hinzufügen'
ADD_USER = 'Benutzer 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_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' ADMIN = 'Administrator'
ADMINISTRATION = 'Verwaltung' ADMINISTRATION = 'Verwaltung'
ALL = 'Alles' ALL = 'Alles'
APPROVE = 'Genehmigen' APPROVE = 'Genehmigen'
APP_NAME = 'Empfangshalle Einloggen / Ausloggen' APP_NAME = 'Einloggen / Ausloggen'
BACK = 'Zurückkehren' BACK = 'Zurückkehren'
BADGE = 'Abzeichen-Nummer' BADGE = 'Abzeichen-Nummer'
BADGEINITIALS = 'Abzeichen-Nummer & Initialen' BADGEINITIALS = 'Abzeichen-Nummer & Initialen'
CARNUM = 'Autokennzeichen'
CHANGE = 'Wechseln' CHANGE = 'Wechseln'
CHOOSE = 'Wählen' CHOOSE = 'Wählen'
CITIZEN = 'Bürger?' CITIZEN = 'Bürger?'
@@ -74,6 +77,7 @@ NAME = 'Vollständiger Name'
NEW = 'Neu' NEW = 'Neu'
NONEAVA = 'Keiner' NONEAVA = 'Keiner'
NOSIGNIN = 'Keine Anmeldung' NOSIGNIN = 'Keine Anmeldung'
NOSITE = 'Kein Standort ausgewählt'
NOTES = 'Anmerkungen' NOTES = 'Anmerkungen'
NOTES_PLACEHOLDER = 'Geben Sie bei Bedarf Notizen ein' NOTES_PLACEHOLDER = 'Geben Sie bei Bedarf Notizen ein'
NOT_AUTHORIZED = 'Nicht berechtigt!' NOT_AUTHORIZED = 'Nicht berechtigt!'
@@ -94,6 +98,7 @@ REASON = 'Grund für den Zugang zu Einrichtungen'
REASONCOMPANY = 'Firma / Grund' REASONCOMPANY = 'Firma / Grund'
REFERENCE = 'Referenz' REFERENCE = 'Referenz'
REFRESH = 'Aktualisieren' REFRESH = 'Aktualisieren'
REGION ='Region'
REMEQPT = 'Ausrüstung entfernen' REMEQPT = 'Ausrüstung entfernen'
REPORTS = 'Berichte' REPORTS = 'Berichte'
REPORTS_DESC = 'Die Dropdown-Liste kann verwendet werden, um vorkonfigurierte Berichte auszuwählen. Weitere Berichte werden gerade geschrieben.' REPORTS_DESC = 'Die Dropdown-Liste kann verwendet werden, um vorkonfigurierte Berichte auszuwählen. Weitere Berichte werden gerade geschrieben.'
@@ -110,6 +115,7 @@ SIGNOUT_THANKYOU = 'Danke - Sie wurden erfolgreich abgemeldet.'
SINCE = 'seit' SINCE = 'seit'
SITE = 'Site' SITE = 'Site'
SOFTWARE_VERSION = 'Version' SOFTWARE_VERSION = 'Version'
SSANUM = 'SSA-Ticketnummer'
START = 'Anfang' START = 'Anfang'
STATEID = 'Staat ID' STATEID = 'Staat ID'
TERMSTITLE = 'Unsere Regeln' TERMSTITLE = 'Unsere Regeln'

View File

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

View File

@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visitas activas'
ADDEQPT = 'Agregar Equipo' ADDEQPT = 'Agregar Equipo'
ADD_USER = 'Agregar usuario' 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_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' ADMIN = 'Administrador'
ADMINISTRATION = 'Administración' ADMINISTRATION = 'Administración'
ALL = 'Todos' ALL = 'Todos'
@@ -17,6 +19,7 @@ APP_NAME = 'Lobby de inicio / cierre de sesión'
BACK = 'Inicia' BACK = 'Inicia'
BADGE = 'Numero de placa' BADGE = 'Numero de placa'
BADGEINITIALS = 'Numero de placa & Sigla' BADGEINITIALS = 'Numero de placa & Sigla'
CARNUM = 'Numero de registro del carro'
CHANGE = 'Cambiar' CHANGE = 'Cambiar'
CHOOSE = 'Por favor seleccione' CHOOSE = 'Por favor seleccione'
CITIZEN = 'Ciudadano de estados unidos?' CITIZEN = 'Ciudadano de estados unidos?'
@@ -74,6 +77,7 @@ NAME = 'Nombre'
NEW = 'Nuevo' NEW = 'Nuevo'
NONEAVA = 'Nada' NONEAVA = 'Nada'
NOSIGNIN = 'No completó' NOSIGNIN = 'No completó'
NOSITE = 'Ningún sitio seleccionado'
NOTES = 'Notas' NOTES = 'Notas'
NOTES_PLACEHOLDER = 'Introduce notas si es necesario' NOTES_PLACEHOLDER = 'Introduce notas si es necesario'
NOT_AUTHORIZED = '¡No autorizado!' NOT_AUTHORIZED = '¡No autorizado!'
@@ -94,6 +98,7 @@ REASON = 'Razón para el acceso a las instalaciones'
REASONCOMPANY = 'Empresa / Razón' REASONCOMPANY = 'Empresa / Razón'
REFERENCE = 'Referencia' REFERENCE = 'Referencia'
REFRESH = 'Recargar' REFRESH = 'Recargar'
REGION ='Región'
REMEQPT = 'Llevar Equipo' REMEQPT = 'Llevar Equipo'
REPORTS = 'Informes' REPORTS = 'Informes'
REPORTS_DESC = 'El menú desplegable a continuación se puede utilizar para seleccionar informes preconfigurados. Otros informes se están escribiendo actualmente.' REPORTS_DESC = 'El menú desplegable a continuación se puede utilizar para seleccionar informes preconfigurados. Otros informes se están escribiendo actualmente.'
@@ -110,6 +115,7 @@ SIGNOUT_THANKYOU = 'Gracias, te has desconectado.'
SINCE = 'desde' SINCE = 'desde'
SITE = 'Sitio' SITE = 'Sitio'
SOFTWARE_VERSION = 'Versión del software' SOFTWARE_VERSION = 'Versión del software'
SSANUM = 'Número de boleto de la SSA'
START = 'Comienzo' START = 'Comienzo'
STATEID = 'Identificación del estado' STATEID = 'Identificación del estado'
TERMSTITLE = 'Nuestras reglas' TERMSTITLE = 'Nuestras reglas'

View File

@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visites actives'
ADDEQPT = 'Ajouter un équipement' ADDEQPT = 'Ajouter un équipement'
ADD_USER = 'Ajouter un utilisateur' 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_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' ADMIN = 'Administrateur'
ADMINISTRATION = 'Administration' ADMINISTRATION = 'Administration'
ALL = 'Tout' ALL = 'Tout'
@@ -17,6 +19,7 @@ APP_NAME = 'Vestibule register/se désinscrire'
BACK = 'Retour' BACK = 'Retour'
BADGE = 'Numéro de badge' BADGE = 'Numéro de badge'
BADGEINITIALS = 'Numéro de badge & Initiales' BADGEINITIALS = 'Numéro de badge & Initiales'
CARNUM = 'Numéro d&#39;immatriculation'
CHANGE = 'Changement' CHANGE = 'Changement'
CHOOSE = 'Choisir' CHOOSE = 'Choisir'
CITIZEN = 'Citoyen?' CITIZEN = 'Citoyen?'
@@ -74,6 +77,7 @@ NAME = 'Nom complet'
NEW = 'Nouveau' NEW = 'Nouveau'
NONEAVA = 'Aucun' NONEAVA = 'Aucun'
NOSIGNIN = 'Pas de connexion' NOSIGNIN = 'Pas de connexion'
NOSITE = 'Aucun site sélectionné'
NOTES = 'Notes' NOTES = 'Notes'
NOTES_PLACEHOLDER = 'Entrez des notes si nécessaire' NOTES_PLACEHOLDER = 'Entrez des notes si nécessaire'
NOT_AUTHORIZED = 'Pas autorisé!' NOT_AUTHORIZED = 'Pas autorisé!'
@@ -94,6 +98,7 @@ REASON = 'Raison de laccès aux installations'
REASONCOMPANY = 'Organisation / Raison' REASONCOMPANY = 'Organisation / Raison'
REFERENCE = 'Reference' REFERENCE = 'Reference'
REFRESH = 'Actualiser' REFRESH = 'Actualiser'
REGION ='Région'
REMEQPT = 'Remove Equipment' REMEQPT = 'Remove Equipment'
REPORTS = 'Rapports' 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.' 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 +115,7 @@ SIGNOUT_THANKYOU = 'Merci - vous avez été déconnecté avec succès.'
SINCE = 'depuis' SINCE = 'depuis'
SITE = 'Site' SITE = 'Site'
SOFTWARE_VERSION = 'Version' SOFTWARE_VERSION = 'Version'
SSANUM = 'Numéro de billet SSA'
START = 'Début' START = 'Début'
STATEID = 'State ID' STATEID = 'State ID'
TERMSTITLE = 'Nos règles' TERMSTITLE = 'Nos règles'

View File

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

230
users.php
View File

@@ -17,38 +17,88 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP session_save_path('.tmp'); // TEMP
session_start(); // START session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD require_once __DIR__ . '/autoload.php'; // AUTOLOAD
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES $StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
$Users = new \App\LobbySIO\Database\Users(); $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']; }; if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR if (isset($session_user)) { // GET UID OR SET TO KIOSK
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE FUNCTION $uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_current_pageicon = '<i class="fas fa-list"></i> '; // PAGE ICON $app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
require_once("inc/header.inc.php"); // SHOW HEADER if(!isset($app_disp_lang)) {
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS $app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
echo $StaticFunctions->killSession(); // ELSE DIE $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 { ?> } else { ?>
<!-- CONTENT START --> <!-- 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 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 <?php if (!empty($_POST['edituser'])): // NEW SITE
if (!empty($_POST['deluser'])) { //$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) { //header('Location: ' . $_SERVER['PHP_SELF']);
$deleteid = (int) $_POST['deleteid'];
echo $Users->deleteUser($deleteid); endif;
echo "user deleted!"; ?>
<?php // POST ACTIONS
if (!empty($_POST['newsite'])): // NEW SITE
$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
header('Location: ' . $_SERVER['PHP_SELF']); 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 // Set up pagination
$page_num = 1; $page_num = 1;
@@ -66,7 +116,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<!-- USER MGMT START -->
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
@@ -86,7 +136,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<tbody> <tbody>
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?> <?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
<tr> <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> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@@ -113,31 +163,6 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
<p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p> <p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p>
</div> </div>
</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"> <fieldset id="registration">
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
@@ -184,27 +209,55 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</div> </div>
</div> </div>
<!-- MODAL END --> <!-- 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="container">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<h2><?php echo $app_current_pageicon . $transLang['USERS']; ?></h2> <h2><?php echo $app_current_pageicon . $transLang['SITE']; ?></h2>
</div> </div>
<div class="col-sm"> <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>
</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"> <table class="table">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <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> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?> <?php foreach($SiteInfo->getSite("0", "0", $StaticFunctions->getPageRows(), $offset1) as $row1): ?>
<tr> <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> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@@ -215,11 +268,11 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
?> ?>
<!-- MODAL START --> <!-- 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-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
@@ -228,69 +281,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"> <form class="form-inline my-2 my-lg-0" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div class="row"> <div class="row">
<div class="col-sm"> <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>
</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"> <fieldset id="registration">
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<div class="col-sm"> <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>
<div class="col-sm"> <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> </div>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<input type="text" class="form-control" id="username" name="username" placeholder="Username" required /> <select class="form-control" id="region" name="region" required>
</div> <option value=""><?php echo $transLang['REGION']; ?></option>
<div class="col-sm"> <option>CAN</option>
<input type="text" class="form-control" id="email" name="email" placeholder="Email" /> <option>EMEA</option>
</div> <option>US</option>
</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> </select>
</div> </div>
<div class="col-sm"> <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> </div>
</div> </div>
@@ -302,6 +319,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</div> </div>
</div> </div>
<!-- MODAL END --> <!-- MODAL END -->
<!-- SITE MGMT END -->
<!-- CONTENT END --> <!-- CONTENT END -->