Rough encrypt

This commit is contained in:
Josh North 2021-09-22 16:32:35 -04:00
parent f8f37fe6e2
commit 14d5e510aa
3 changed files with 145 additions and 64 deletions

View File

@ -23,8 +23,13 @@ SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_countries`;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
CREATE TABLE `lsio_countries` (
`id` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Unique ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Country Name',
@ -32,6 +37,7 @@ CREATE TABLE `lsio_countries` (
`priority` int NOT NULL DEFAULT '9' COMMENT 'Priority Sort',
`ban` int NOT NULL DEFAULT '0' COMMENT 'Sanctioned Country'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='Country List';
INSERT INTO `lsio_countries` (`id`, `name`, `continent`, `priority`, `ban`) VALUES
('AD', 'Andorra', 'Europe', 9, 0),
('AE', 'United Arab Emirates', 'Asia', 9, 0),
@ -277,70 +283,66 @@ INSERT INTO `lsio_countries` (`id`, `name`, `continent`, `priority`, `ban`) VALU
('ZA', 'South Africa', 'Africa', 9, 0),
('ZM', 'Zambia', 'Africa', 9, 0),
('ZW', 'Zimbabwe', 'Africa', 9, 0);
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_idtypes`;
CREATE TABLE `lsio_idtypes` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`name` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Language File Code'
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'ID TYPE NAME (WILL BE TRANSLATED)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_idtypes` (`id`, `name`) VALUES
(3, 'PASSPORT'),
(2, 'STATEID'),
(1, 'UNAVAIL');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_sites`;
(3, 'STR_IDTYPES_PASSPORT'),
(2, 'STR_IDTYPES_STATEID'),
(1, 'STR_IDTYPES_UNAVAIL');
CREATE TABLE `lsio_sites` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Location Code',
`timezone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'ISO Timezone',
`region` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Region Group'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`, `region`) VALUES
(1, 'NOSITE', 'UTC', 'NO'),
(2, 'Default Site', 'America/New_York', 'US');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users`;
CREATE TABLE `lsio_users` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Unique Username',
`password` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Password',
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Unique Username',
`password` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Password',
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Unique Email',
`created` datetime NOT NULL COMMENT 'Create Date',
`created` datetime DEFAULT NULL COMMENT 'Create Date',
`firstname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Given Name',
`lastname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Surname',
`usertype` int UNSIGNED NOT NULL COMMENT 'Type permissions',
`timezone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'ISO Timezone'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_users` (`id`, `username`, `password`, `email`, `created`, `firstname`, `lastname`, `usertype`, `timezone`) VALUES
(1, 'admin', '$2a$08$Y6l2CUoQgTQfQErQPEYZEuoZqDxkpAU34CoTTr7bc2oefzclUILJy', '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$Y6l2CUoQgTQfQErQPEYZEuoZqDxkpAU34CoTTr7bc2oefzclUILJy', 'user1@domain.com', '2018-09-23 00:00:00', 'First', 'Last', 2, '');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users_sites`;
(2, 'KIOSK', '', '', '2018-10-19 00:00:00', 'KIOSK', 'KIOSK', 3, '');
CREATE TABLE `lsio_users_sites` (
`sites_id` int UNSIGNED NOT NULL COMMENT 'Site ID Link',
`users_id` int UNSIGNED NOT NULL COMMENT 'User ID Link'
) 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`;
(2, 2);
CREATE TABLE `lsio_usertypes` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'User type name'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_usertypes` (`id`, `name`) VALUES
(1, 'USER-TYPES-ADMIN'),
(3, 'USER-TYPES-KIOSK'),
(4, 'USER-TYPES-SADMIN'),
(2, 'USER-TYPES-USER');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_vendorinfo`;
CREATE TABLE `lsio_vendorinfo` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`visitid` int UNSIGNED NOT NULL COMMENT 'Unique Visitor ID',
@ -358,16 +360,16 @@ CREATE TABLE `lsio_vendorinfo` (
`sitecleanup` tinyint DEFAULT '0',
`doccompleted` tinyint DEFAULT '0',
`worksummary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Work Summary',
`equipmentsummary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Equipment Summary'
`equipmentsummary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Equipment Summary',
`customerimpacted` varchar(30) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visits`;
CREATE TABLE `lsio_visits` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`firstname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Given Name',
`lastname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Surname',
`company` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Company',
`escort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Escort Name',
`firstname` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Given Name',
`lastname` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Surname',
`company` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Company',
`escort` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Escort Name',
`intime` datetime NOT NULL COMMENT 'Time In',
`outtime` datetime DEFAULT NULL COMMENT 'Time Out',
`signature` mediumblob COMMENT 'Signature Image',
@ -381,55 +383,65 @@ CREATE TABLE `lsio_visits` (
`site_id` int UNSIGNED DEFAULT NULL COMMENT 'Site ID Link',
`reason` int UNSIGNED DEFAULT NULL COMMENT 'Reason Code',
`approved` tinyint DEFAULT '1' COMMENT '0 void, 1 unapproved, 2 approved',
`carnum` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Tag Number',
`carnum` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Tag Number',
`ssanum` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'Ticket Number',
`isvendor` tinyint DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visittypes`;
CREATE TABLE `lsio_visittypes` (
`id` int UNSIGNED NOT NULL COMMENT 'Unique ID',
`name` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Visit Type Name',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Visit Type Name',
`isvendor` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(1, 'NONEAVA', 0),
(2, 'ADDEQPT', 0),
(3, 'REMEQPT', 0),
(4, 'MEETING', 0),
(5, 'TOUR', 0),
(6, 'TESTING', 0),
(7, 'INSTHARD', 0),
(8, 'INSTSOFT', 0),
(9, 'MAINHARD', 0),
(10, 'MAINSOFT', 0),
(11, 'FACCLEAN', 1),
(12, 'PREVMAIN', 1),
(13, 'BRKFIX', 1),
(14, 'TELCO', 1);
-- --------------------------------------------------------
INSERT INTO `lsio_visittypes` (`id`, `name`, `isvendor`) VALUES
(1, 'STR_VISITTYPES_NONE', 0),
(2, 'STR_VISITTYPES_ADDEQPT', 0),
(3, 'STR_VISITTYPES_REMEQPT', 0),
(4, 'STR_VISITTYPES_MEETING', 0),
(5, 'STR_VISITTYPES_TOUR', 0),
(6, 'STR_VISITTYPES_TESTING', 0),
(7, 'STR_VISITTYPES_INSTHARD', 0),
(8, 'STR_VISITTYPES_INSTSOFT', 0),
(9, 'STR_VISITTYPES_MAINHARD', 0),
(10, 'STR_VISITTYPES_MAINSOFT', 0),
(11, 'STR_VISITTYPES_FACCLEAN', 1),
(12, 'STR_VISITTYPES_PREVMAIN', 1),
(13, 'STR_VISITTYPES_BRKFIX', 1),
(14, 'STR_VISITTYPES_TELCO', 1);
ALTER TABLE `lsio_countries`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_idtypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_sites`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_users`
ADD PRIMARY KEY (`id`),
ADD KEY `users_ibfk_1` (`usertype`);
ALTER TABLE `lsio_users_sites`
ADD UNIQUE KEY `user_site_perm` (`sites_id`,`users_id`) USING BTREE,
ADD KEY `users_id` (`users_id`);
ALTER TABLE `lsio_usertypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_vendorinfo`
ADD PRIMARY KEY (`id`);
ALTER TABLE `lsio_visits`
ADD PRIMARY KEY (`id`),
ADD KEY `site_id` (`site_id`),
@ -437,31 +449,42 @@ ALTER TABLE `lsio_visits`
ADD KEY `id_checked` (`id_reference`),
ADD KEY `citizen` (`citizen`),
ADD KEY `id_type` (`id_type`);
ALTER TABLE `lsio_visittypes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `name` (`name`);
-- --------------------------------------------------------
ALTER TABLE `lsio_idtypes`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=100;
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_sites`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=107;
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_users`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=104;
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_usertypes`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_visits`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=401;
ALTER TABLE `lsio_visittypes`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=11;
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_vendorinfo`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=11;
-- --------------------------------------------------------
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_visits`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_visittypes`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Unique ID', AUTO_INCREMENT=101;
ALTER TABLE `lsio_users`
ADD CONSTRAINT `lsio_users_ibfk_1` FOREIGN KEY (`usertype`) REFERENCES `lsio_usertypes` (`id`);
ALTER TABLE `lsio_users_sites`
ADD CONSTRAINT `lsio_users_sites_ibfk_3` FOREIGN KEY (`sites_id`) REFERENCES `lsio_sites` (`id`),
ADD CONSTRAINT `lsio_users_sites_ibfk_4` FOREIGN KEY (`users_id`) REFERENCES `lsio_users` (`id`);
ALTER TABLE `lsio_visits`
ADD CONSTRAINT `lsio_visits_ibfk_1` FOREIGN KEY (`id_type`) REFERENCES `lsio_idtypes` (`id`),
ADD CONSTRAINT `lsio_visits_ibfk_2` FOREIGN KEY (`reason`) REFERENCES `lsio_visittypes` (`id`),

55
classes/visit.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
* Copyright (C) 2018 josh.north@point808.com
*
* 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/>.
*/
/**
* Get visit info as array by visit id. Pass % for all.
* TODO - break into select sections for speed by pagination
* Pass NULL for nulls, % for any not null
*
* @author josh.north
*/
namespace classes;
use App\LobbySIO\Config\Registry;
class visit {
public function dbprefix() {
echo Registry::DB_PRFX;
}
// Properties
public $name;
public $color;
// Methods
function set_name($name) {
$this->name = $name;
}
function get_name() {
return $this->name;
}
}

View File

@ -93,6 +93,9 @@
echo '<pre>' . print_r($_POST, true) . '</pre>';
echo 'Verification has been : ' . (Classes\Misc\Csrf::verifyToken('home') ? 'successful' : 'unsuccessful');
}
Classes\Visit::dbprefix();
?>