capstone website project - walkthru begins p40
TRANSCRIPT
![Page 1: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/1.jpg)
1
eMetro Emergency Medical Services System DocumentationTeam: Kevin O’Neil, Jeff Goldberg
Webserver Maintenance & Security Certificate Class Project
Kevi
AbstractThe eMetro Medical Services dispatch system provides 911 operators a graphical drag-n-drop interface to dispatch patients to a set of hospitals and provides automated publish-subscribe messaging to ER hospitals using the Mosquitto MQTT message broker. All dispatch events are
recorded in a MySQL database.
December 8, 2015
![Page 2: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/2.jpg)
eMetro Emergency Medical Services System Documentation
Revision History
Creation Date: 12/8/2015
Last Update: 1/12/2016
AbstractThe eMetro Medical Services dispatch system provides 911 operators a graphical drag-n-drop interface
to dispatch patients to a set of hospitals and provides automated publish-subscribe messaging to ER hospitals using the Mosquitto MQTT message broker. All dispatch events are recorded in a MySQL
database.
2
![Page 3: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/3.jpg)
Table of ContentsIntroduction.................................................................................................................................................4
Requirements..............................................................................................................................................4
Project Requirements..............................................................................................................................4
Extra Requirements Created by Team......................................................................................................4
System Model..............................................................................................................................................5
eMetro Block Definition Diagram............................................................................................................5
Dispatcher User Interface............................................................................................................................5
Dispatch Report...................................................................................................................................7
Mosquitto MQTT Message Broker...............................................................................................................8
Installing Mosquitto MQTT......................................................................................................................9
Getting Mosquitto Status & Stopping....................................................................................................10
Mosquitto-Clients..................................................................................................................................11
JQuery User Interface................................................................................................................................11
911 Dispatcher Command Center, PHP......................................................................................................12
File: testdrag6.php.................................................................................................................................12
File: log.php...........................................................................................................................................15
Windows Share Folder...............................................................................................................................16
Mosquitto MQTT Setup.............................................................................................................................21
Mosquitto Subscriber.............................................................................................................................22
Mosquitto Publish..................................................................................................................................22
MQTT Utility (Java).................................................................................................................................23
Database Tools: phpMyAdmin...................................................................................................................26
emetromedical Database...........................................................................................................................27
Dispatch Table........................................................................................................................................28
Hospital Table........................................................................................................................................29
Database Export.....................................................................................................................................29
Database Join.........................................................................................................................................33
Table structure for table hospital...........................................................................................................33
Data Dump for Table Hospital................................................................................................................34
Simple Join of Dispatch and Hospital Tables..........................................................................................343
![Page 4: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/4.jpg)
Join Results............................................................................................................................................34
Join Dispatch and Hospital Tables SQL with Added Dispatch DateTimeStamp.......................................35
Join Results with Dispatch DateTimeStamp...........................................................................................35
Inner Join Version PHP Code..................................................................................................................35
Online Report Result..............................................................................................................................37
Socket.io....................................................................................................................................................37
Jquery........................................................................................................................................................37
Nodejs server.........................................................................................................................................38
4
![Page 5: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/5.jpg)
IntroductionThe eMetro Medical services dispatch screen displays the patient icon representing the patient to be transported. The 911 dispatcher drags the patient icon to one of the hospital emergency room drop icon spaces. When the drag patient icon is dragged and dropped on the hospital icon the database is updated with the dispatch event date, time, patient ID and hospital ID.
Requirements
Project RequirementsID P-R 1 System must demonstrate use of a web browser interface.
ID P-R 2 System must demonstrate use of PHP.
ID P-R 3 System must demonstrate use of HTML.
ID P-R 4 System must demonstrate use of the Apache Web Server.
ID P-R 5 System must demonstrate use of shell scripting.
ID P-R 6 System must demonstrate use of a database.
ID P-R 7 System must demonstrate use of Linux and Windows share folder.
ID P-R 8 System must demonstrate use of a SQL join query.
Extra Requirements Created by TeamID P-R 9 System must be able to support 911 operators sending reliable dispatch messages to subscriber hospitals using MQTT Broker.
ID P-R 10 System must be able to support subscription by hospitals using a MQTT Client.
ID P-R 11 System must be able to show live MQTT Broker monitoring.
ID P-R 12 System must utilize drag-and-drop for ease-of-use user interface (jQuery UI).
ID P-R 13 System must automatically update database when a drag-and-drop action is taken by 911 operator.
ID P-R 14 System must support MQTT Client access to MQTT Broker (Socket.io, Nodejs).
ID P-R 15 System must demonstrate use of Nodejs.
ID P-R 16 System must demonstrate use of Bootstrap Framework.
ID P-R 17 System must demonstrate use of database reporting.
5
![Page 6: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/6.jpg)
ID P-R 18 System must demonstrate use of JSON Callback for database detail.
System ModeleMetro Block Definition DiagramThe eMetro block definition diagram (bdd) below captures the major system components and stakeholders.
Dispatcher User InterfaceThe eMetro Medical services dispatch screen displays the patient icon representing the patient to be transported. The 911 dispatcher drags the patient icon to one of the hospital emergency room drop icon spaces. When the drag patient icon is dragged and dropped on the hospital icon the database is updated with the dispatch event date, time, patient ID and hospital ID.
6
![Page 7: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/7.jpg)
When the patient icon is dragged to the hospital icon rectangle the database is updated with dispatch information and a MQTT command is executed triggering the MQTT message broker to send a message that the patient has been dispatched, see subscriber window below.
7
![Page 8: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/8.jpg)
Dispatch ReportPressing “Dispatch Report” button generates a report that is the result of a join between ‘hospital’ and
‘dispatch’ tables to produce a report of 911 operator patient date-time stamped dispatches to which hospitals.
8
![Page 9: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/9.jpg)
Mosquitto MQTT Message BrokerWhen the 911 dispatcher drags the patient icon to one of the available ER rooms a message is created and published to the subscribing ER room. This is depicted in the terminal window for the subscriber below.
9
![Page 10: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/10.jpg)
Installing Mosquitto MQTTMosquitto MQTT is a message broker that supports version 3.1 and 3.1.1 of the MQTT protocol.
http://mosquitto.org
MQTT provides a method of carrying out messaging using a publish/subscribe model. It is lightweight, both in terms of bandwidth usage and ease of implementation. This makes it particularly useful at the edge of the network where a sensor or other simple device may be implemented using an arduino for example.
Install commands:
sudo apt-get install mosquitto
sudo apt-get install mosquito-clients
One recommended install instructions from stackoverflow.
http://stackoverflow.com/questions/27534953/how-do-i-set-up-my-own-mqtt-server-with-mosquitto
sudo apt-get update
sudo apt-get install mosquitto
sudo update-rc.d mosquitto defaults
10
![Page 11: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/11.jpg)
sudo /etc/init.d/mosquitto start
Getting Mosquitto Status & Stoppingsudo /etc/init.d/mosquitto status
sudo /etc/init.d/mosquitto stop
11
![Page 12: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/12.jpg)
Mosquitto-ClientsThis is two MQTT version 3.1 command line clients. mosquitto_pub can be used to publish messages to a broker and mosquitto_sub can be used to subscribe to a topic to receive messages.
JQuery User InterfaceThe jquery user interface library (jquery-ui.js and other components) is used to support drag and drop user interface functionality. You can download from jqueryui.com.
http://jqueryui.com/draggable/
12
![Page 13: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/13.jpg)
911 Dispatcher Command Center, PHP
File: testdrag6.phpFunctions are to create a 911 drag-n-drop user interface displaying a patient icon and available hospital emergency rooms. The 911 operator can then drag a patient icon onto a hospital icon and create a dispatch order and message informing the hospital ER that a patient is being dispatched to their hospital.
<?php/** * Created by PhpStorm. * User: user01 * Date: 10/29/2015 * Time: 9:15 PM */session_start();require_once('/var/www/config.php');
function query_db($query){ //need: host, user, password, database $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if (!$link) { echo "Error: Unable to connect to MySQL." . PHP_EOL; echo "Debugging error: " . mysqli_connect_errno() . PHP_EOL; echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; exit; }
//run the actual query $result = $link->query($query);
mysqli_close($link);
return $result;
13
![Page 14: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/14.jpg)
}//end function query_db
//DO NOT TOUCH ABOVE THIS LINE - GENERAL DB FUNCTIONS
//START WEB PAGE
?>
<script src="lib/jquery-2.1.4.min.js"></script><script> $( document ).ready(function() {//DOCUMENT IS FULLY LOADED ON CLIENT (BROWSER)
$( "#draggable" ).click(function() {//CHECK FOR CLICK EVENT ON ID// $.post( "log.php", { ad: "1", action: "1", patientid: "1" } )// .done(function( data ) {// alert( "Data Loaded: " + data ); }); });
/* $( "#ad1" ).mouseout(function() {//CHECK FOR HOVER EVENT ON ID $.post( "log.php", { ad: "1", action: "3" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); }); });
$( "#ad1" ).mouseover(function() {//CHECK FOR HOVER EVENT ON ID $.post( "log.php", { ad: "1", action: "2" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); }); });*/
/* $( "#ad2" ).click(function() {//CHECK FOR CLICK EVENT ON ID var ad = "2"; $.post( "log.php", { ad: ad, action: "1" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); }); });
$( "#ad2" ).mouseout(function() {//CHECK FOR HOVER EVENT ON ID var ad = "2"; $.post( "log.php", { ad: ad, action: "3" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); }); });
$( "#ad2" ).mouseover(function() {//CHECK FOR HOVER EVENT ON ID var ad = "2"; $.post( "log.php", { ad: ad, action: "2" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); });*/ });// });</script>
14
![Page 15: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/15.jpg)
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <title>jQuery UI Droppable - Default functionality</title>
<h1> eMetro Emergency Medical Services </h1> <p>Drag and drop patient icon to one of the hospitals on the right.</p> <p>Patient will be routed to the emergency room at that hospital.</p>
<a class="btn" href="report.php"> <button class="btn" type="submit">Dispatch Report</button></a>
<!-- <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">-->
<link rel="stylesheet" href="lib/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<!-- <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>-->
<script src="lib/jquery-ui.js"></script>
<!-- <link rel="stylesheet" href="/resources/demos/style.css">-->
<link rel="stylesheet" href="lib/style.css">
<style> #draggable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } #droppable { width: 300px; height: 500px; padding: 0.5em; float: right; margin: 10px; } #droppable2 { width: 300px; height: 500px; padding: 0.5em; float: right; margin: 10px; } </style> <script>$(function() { $( "#draggable" ).draggable(); $( "#droppable" ).droppable({ drop: function( event, ui ) { $( this ) .addClass( "ui-state-highlight" ) .find( "p" ) .html( "Patient routed to Sharp Memorial" );
// Post to database patient routed to Sharp Memorial $.post( "log.php", { ad: "1", action: "1", hospitalid: "2", patientid: "1" } ) .done(function( data ) {// alert( "Data Loaded: " + data ); });
} }); $( "#droppable2" ).droppable({ drop: function( event, ui ) { $( this ) .addClass( "ui-state-highlight" ) .find( "p" )
15
![Page 16: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/16.jpg)
.html( "Patient routed to Sharp Grossmont" );
// Post to database patient routed to Sharp Grossmont $.post( "log.php", { ad: "1", action: "1", hospitalid: "1", patientid: "1"} ) .done(function( data ) {// alert( "Data Loaded: " + data ); });
} }); }); </script></head><body>
<div id="draggable" class="ui-widget-content"> <img src="ad_repository/pia_picture_w150_h150.png"> <p>Patient K_ONEIL</p> <p>Assessment: C-spine and internal injuries, auto accident</p> <p>Current Location: 163 south bound, 1/2 mile south of Balboa Ave. ext</p></div>
<div id="droppable" class="ui-widget-header"> <img src="ad_repository/sharp_er.jpg"> <p>No 2: Sharp Memorial Hospital Emergency Room</p> <br>7901 Frost St, San Diego, CA 92123</br><!-- <br>Transfer/Drop here</br>-->
</div>
<div id="droppable2" class="ui-widget-header"> <img src="ad_repository/sharp_grossmont_er.jpg"> <p>No 1: Sharp Grossmont Hospital Emergency Care</p> <br>5555 Grossmont Center Drive, La Mesa, CA 91942</br><!-- <p>Transfer/Drop here</p>--></div></body></html>
File: log.phpFunctions are to access emetromedical database and perform dispatch updates. Second function is to execute a shell command to publish a MQTT message and notify the subscribing hospitals of the patient dispatches.
<?php //24-OCT-2015 //file: log.php
session_start(); require_once('/var/www/config.php');
16
![Page 17: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/17.jpg)
function query_db($query){ //need: host, user, password, database $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, "emetromedical");
if (!$link) { echo "Error: Unable to connect to MySQL." . PHP_EOL; echo "Debugging error: " . mysqli_connect_errno() . PHP_EOL; echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; exit; }
//run the actual query $result = $link->query($query);
mysqli_close($link);
return $result; }//end function query_db
//DO NOT TOUCH ABOVE THIS LINE - GENERAL DB FUNCTIONS
$ad = (int)$_POST['ad']; $action = (int)$_POST['action']; $hospitalid = (int)$_POST['hospitalid']; $patientid = (int)$_POST['patientid']; /* echo "data stored: "; echo "ad: ".$ad."<br />"; echo "action:".$action;*/ $ip=$_SERVER['REMOTE_ADDR']; // echo "IP address= $ip";
//build query //action codes: 1=click, 2=mouseover, 3=mouseout //store: ip, ad, action, timedate $query = "INSERT INTO dispatch (action, stamp, adid, ipaddr, hospitalid, patientid) VALUES ('".$action."', now(), '".$ad."', '".$ip."', '".$hospitalid."', '".$patientid."')";echo $query; query_db($query);
$cmd = 'mosquitto_pub -h localhost -t emetro -m /"patient K_ONEIL enroute to: "'.$hospitalid.'"";';exec($cmd, $stdout, $stderr);echo "hi bob";?>
Windows Share FolderInstructions
On the Ubuntu server open a terminal window and execute mount command with the root account:
mount -t cifs -o username=ioneil,password=cool //10.103.20.21/share /var/www/html/
Must have IP address of Windows machine. You open a command window within Windows.
17
![Page 18: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/18.jpg)
Execute ‘cmd’ command in Start Window.
18
![Page 19: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/19.jpg)
19
![Page 20: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/20.jpg)
Execute ‘ipconfig’ command.
20
![Page 21: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/21.jpg)
Current IP address for Windows machine is 10.103.26.119.
21
![Page 22: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/22.jpg)
Mosquitto MQTT SetupMosquitto MQTT has to be running.
Start Mosquitto by using the ‘mosquitto’ command. This terminal window will show mosquito events such as when you create a subscriber and publish messages to the broker.
22
![Page 23: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/23.jpg)
Mosquitto Subscriber
Open another terminal window with another account besides root.
Execute the ‘mosquitto_sub –h localhost –t emetro’ command. This will subscribe to the topic ‘emetro’ and this terminal window will display messages published to the topic.
Mosquitto PublishNow execute the publish command: mosquito_pub –h localhost –t emetro –m “hello jeff”
23
![Page 24: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/24.jpg)
As you can see in the prior screen capture the subscriber window has received the “hello jeff” message.
These terminal windows are for subscriber hospitals what will receive MQTT messages when the patient icon is dropped on the hospital icon.
MQTT Utility (Java)
http://www.eclipse.org/paho/
https://repo.eclipse.org/content/repositories/paho-releases/org/eclipse/paho/mqtt-utility/0.4.0/
mqtt-utility-0.4.0.jar is a Java utility for testing MQTT.
Alternatively the Paho Java library jars can be downloaded directly from the following URLs;
https://repo.eclipse.org/content/repositories/paho-releases/ - Official Releases
Execute the Jar file by double clicking on the file.
This executable Java file was stored in the c:/mtn/share/nodejs folder.
24
![Page 25: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/25.jpg)
The 192.168.145.129 address for the Ubuntu server and port 1883 was used to connect to the MQTT server, see below.
You can create/subscribe to a topic and test sending/publishing messages to the topic with this Java MQTT utility.
25
![Page 26: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/26.jpg)
Example subject of “emetro” with test message of “hi kevin”
26
![Page 27: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/27.jpg)
Database Tools: phpMyAdminMySQL is the database. Log into phpMyAdmin to administrate the database.
27
![Page 28: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/28.jpg)
emetromedical Database
28
![Page 29: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/29.jpg)
Dispatch Table
29
![Page 30: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/30.jpg)
Hospital Table
Database Export
-- phpMyAdmin SQL Dump
-- version 4.4.13.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 09, 2016 at 09:54 AM
-- Server version: 5.6.27-0ubuntu1
-- PHP Version: 5.6.11-1ubuntu3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
30
![Page 31: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/31.jpg)
/*!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 */;
--
-- Database: `emetromedical`
--
-- --------------------------------------------------------
--
-- Table structure for table `dispatch`
--
CREATE TABLE IF NOT EXISTS `dispatch` (
`id` int(11) NOT NULL,
`view` datetime NOT NULL,
`click` datetime NOT NULL,
`action` int(11) NOT NULL,
`stamp` datetime NOT NULL,
`adid` int(11) NOT NULL,
`patientid` int(11) NOT NULL,
`hospitalid` int(11) NOT NULL,
`ipaddr` varchar(20) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=251 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `dispatch`
31
![Page 32: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/32.jpg)
--
INSERT INTO `dispatch` (`id`, `view`, `click`, `action`, `stamp`, `adid`, `patientid`, `hospitalid`, `ipaddr`) VALUES
(237, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-11-17 20:44:32', 1, 1, 1, '192.168.145.1'),
(238, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-11-17 20:45:15', 1, 1, 2, '192.168.145.1'),
(239, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-11-17 20:49:48', 1, 1, 1, '192.168.145.1'),
(240, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-11-19 17:44:16', 1, 1, 1, '192.168.145.1'),
(241, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 08:39:14', 1, 1, 1, '192.168.145.1'),
(242, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 09:18:54', 1, 1, 2, '192.168.145.1'),
(243, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 13:11:42', 1, 1, 1, '192.168.145.1'),
(244, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 13:57:42', 1, 1, 2, '192.168.145.1'),
(245, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 14:02:54', 1, 1, 1, '192.168.145.1'),
(246, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-05 14:03:04', 1, 1, 2, '192.168.145.1'),
(247, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-08 21:27:20', 1, 1, 1, '192.168.145.1'),
(248, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-10 17:58:29', 1, 1, 1, '192.168.145.1'),
(249, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2015-12-10 17:59:37', 1, 1, 2, '192.168.145.1'),
(250, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '2016-01-07 18:46:22', 1, 1, 1, '192.168.145.1');
-- --------------------------------------------------------
--
-- Table structure for table `hospital`
--
CREATE TABLE IF NOT EXISTS `hospital` (
`hospitalid` int(11) NOT NULL,
`name` varchar(40) NOT NULL,
`address1` varchar(30) NOT NULL,
32
![Page 33: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/33.jpg)
`city` varchar(20) NOT NULL,
`zip` int(5) NOT NULL,
`state` varchar(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `hospital`
--
INSERT INTO `hospital` (`hospitalid`, `name`, `address1`, `city`, `zip`, `state`) VALUES
(1, 'Sharp Grossmont', '5555 Grossmont Center Drive', 'La Mesa', 91942, 'CA'),
(2, 'Sharp Memorial', '7901 Frost Street', 'San Diego', 92123, 'CA'),
(3, 'Scripps Green ', '10666 N. Torrey Pines Rd.', 'La Jolla', 92037, 'CA'),
(4, 'Scripps Memorial Hospital Encinitas', '354 Santa Fe Drive', 'Encinitas', 92024, 'CA'),
(5, 'Scripps Mercy Hospital San Diego', '4077 5th Avenue', 'San Diego', 92103, 'CA');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `dispatch`
--
ALTER TABLE `dispatch`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `hospital`
--
33
![Page 34: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/34.jpg)
ALTER TABLE `hospital`
ADD PRIMARY KEY (`hospitalid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `dispatch`
--
ALTER TABLE `dispatch`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=251;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Database Join
A second ‘hospital’ table was created to contain hospital address information.
Table structure for table hospitalColumn Type Null Default
hospitalid int(11) No
name varchar(40) No
address1 varchar(30) No
city varchar(20) No
zip int(5) No
state varchar(2) No
34
![Page 35: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/35.jpg)
Data Dump for Table Hospital1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 91942 CA
2 Sharp Memorial 7901 Frost Street San Diego 92123 CA
3 Scripps Green 10666 N. Torrey Pines Rd. La Jolla 92037 CA
4 Scripps Memorial Hospital Encinitas 354 Santa Fe Drive Encinitas 92024 CA
5 Scripps Mercy Hospital San Diego 4077 5th Avenue San Diego 92103 CA
Simple Join of Dispatch and Hospital TablesA join between the tables ‘dispatch’ and ‘hospital’:
SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city
FROM dispatch, hospital
WHERE dispatch.hospitalid = hospital.hospitalid
Join Results1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa
2 Sharp Memorial 7901 Frost Street San Diego
2 Sharp Memorial 7901 Frost Street San Diego
2 Sharp Memorial 7901 Frost Street San Diego
2 Sharp Memorial 7901 Frost Street San Diego
2 Sharp Memorial 7901 Frost Street San Diego
35
![Page 36: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/36.jpg)
Join Dispatch and Hospital Tables SQL with Added Dispatch DateTimeStamp
SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city, dispatch.stamp AS DispatchDateTimeStamp FROM dispatch, hospitalWHERE dispatch.hospitalid = hospital.hospitalid
Join Results with Dispatch DateTimeStamp1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-11-17 20:44:32
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-11-17 20:49:48
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-11-19 17:44:16
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-12-05 08:39:14
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-12-05 13:11:42
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-12-05 14:02:54
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-12-08 21:27:20
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2015-12-10 17:58:29
1 Sharp Grossmont 5555 Grossmont Center Drive La Mesa 2016-01-07 18:46:22
2 Sharp Memorial 7901 Frost Street San Diego 2015-11-17 20:45:15
2 Sharp Memorial 7901 Frost Street San Diego 2015-12-05 09:18:54
2 Sharp Memorial 7901 Frost Street San Diego 2015-12-05 13:57:42
2 Sharp Memorial 7901 Frost Street San Diego 2015-12-05 14:03:04
2 Sharp Memorial 7901 Frost Street San Diego 2015-12-10 17:59:37
Inner Join Version PHP Code<?php
session_start(); require_once('/var/www/config.php'); $records_per_page = 100; $cur_page = (int)$_GET['cur_page']; if (!$cur_page || $cur_page == 0){ $cur_page=1; }
//need: host, user, password, database $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, "emetromedical");
36
![Page 37: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/37.jpg)
//GET COUNT OF RECORDS $sql_count = "SELECT count(*) AS COUNT FROM dispatch INNER JOIN hospital ON dispatch.hospitalid=hospital.hospitalid"; $result1 = $link->query($sql_count); foreach ($result1 as $row){ $total_records = $row['COUNT']; }
//join query notes
//SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city, dispatch.stamp AS DispatchDateTimeStamp //FROM dispatch, hospital //WHERE dispatch.hospitalid = hospital.hospitalid
//run the actual query $sql_query = "SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city, dispatch.stamp FROM dispatch INNER JOIN hospital ON dispatch.hospitalid=hospital.hospitalid LIMIT 0,".$records_per_page; $result = $link->query($sql_query);
//REPORT HEADER $content = '<table width="100%"><thead><tr>'; $content .= '<td width="20%">ID</td><td width="20%">HospitalName</td><td width="20%">Address</td><td width="20%">City</td><td width="20%">DispatchDateTime</td></thead>'; $content .= "<tbody>";
foreach($result as $row){ //COLLECT INFO FROM DB -> ASSIGN TO VARIABLES $hospitalid = $row['hospitalid']; $hospitalname = $row['name']; $address = $row['address1']; $city = $row['city']; $dispatchdatetime = $row['stamp'];
//APPEND INFO FROM VARIABLES TO OUTPUT BUFFER/VARIABLE $content .= "<td>".$hospitalid."</td><td>".$hospitalname."</td><td>".$address."</td><td>".$city."</td><td>".$dispatchdatetime."</td></tr>"; }
//REPORT FOOTER $prev_page = $cur_page -1; $next_page = $cur_page +1; if ($cur_page > 1){ $pagination = '<a href="report.php?cur_page='.$prev_page.'"><<< Previous</a>'; } $pagination .= ' <a href="report.php?cur_page='.$next_page.'">Next >>></a>'; $pages = ceil($total_records/$records_per_page);
$content .= '<tr><td align="center" colspan=5>'.$pagination.'</td></tr>'; $content .= '<tr><td align="center" colspan=5>Total Pages:'.$pages.'</td></tr>';
$content .= "</tbody></table><hr>"; echo $content;?>
37
![Page 38: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/38.jpg)
Online Report Result
Socket.io
Download socket.io from:
https://cdn.socket.io/socket.io-1.3.7.js
Load this file into folder on Windows host machine in c:/mtn/share/nodejs folder
socket.io-1.3.7.js
On Ubuntu server load with npm.
Load with “npm install socket.io”.
Jquery
Dowload Jquery from:
http://jquery.com/download/
38
![Page 39: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/39.jpg)
http://code.jquery.com/jquery-2.1.4.min.js
On Windows move this file from the download folder to the mtn/share/nodejs folder.
Nodejs server
On server start nodejs server.
root@ubuntu:/var/www/html/nodejs/server/mqtt2#nodejs server.js
User Registration and Sign in
39
![Page 40: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/40.jpg)
40
![Page 41: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/41.jpg)
Duplicate Registration
Incorrect User ID / Password or Duplicate Sign In
41
![Page 43: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/43.jpg)
User Signed In
Dispatch Patient to Hospital 2
43
![Page 44: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/44.jpg)
Email Fires Off as a Backup Push Notification
Hospital Receives MOSQUITTO MQTT Message to Terminal
44
![Page 45: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/45.jpg)
Configk.php
(database and other details protected from Internet exposure with placement in var/www folder) System also uses Config.php (similar without Admin User ID)
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
define("DB_DATABASE", "usersk");
define("DB_USER", "root");
define("DB_HOST", "localhost");
define("DB_PASS", "jeff");
define("PW_SALT", "bwM#2u46x86HR7atksMLe~XJN3jq5D@c#^CmWSB$&VgDvpFhUPd?rKt%zA9>ZdYT");
$admin = "[email protected]";
?>
45
![Page 46: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/46.jpg)
rs.php Initial Processing Module
<!DOCTYPE html>
<?php
/**
* File: rs.php
* Jeff Goldberg WSMS
*
* 1/2016
*/
require_once("../config.php");
require_once("rs.html");
session_start();
$email = $_POST['email'];
$pass = $_POST['Password'];
$_SESSION['email'] = $email;
if (isset($email) && $email != "") {
$link = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if ($link->connect_error) {
die(" Error: " . $link->connect_error);
46
![Page 47: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/47.jpg)
}
//encrypted password for compare to db
$salted = (sha1($pass.PW_SALT));
// is user in db and not already logged in?
$sql = 'SELECT * FROM users WHERE email="' . $email . '" AND password="'.$salted.'" AND created=0;';
$result = $link->query($sql);
$timestamp = date('Y-m-d HH:mm:ss');
$compare = (sha1($password.PW_SALT));
//find user and verify not already signed in
if ($result->num_rows > 0) {
$check_PW = sha1($pass.PW_SALT)
$sql = 'SELECT * FROM users WHERE email="' . $email . '" AND created=0;';
$result = $link->query($sql)->fetch_assoc();
// flag user as signed in
$sql = 'UPDATE users SET created= now() WHERE email="' . $email . '";';
$result = $link->query($sql);
47
![Page 48: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/48.jpg)
$cmp = `password`;
$_SESSION['email'] = $email;
$_POST['email'] = $email;
// invoke testdrag4.php screen
echo "<script type='text/javascript'>window.top.location='http://localhost/medical/testdrag4.php';</script>"; exit;
} else {
$_POST['email'] = $email;
$_SESSION['email'] = $email;
echo "jeff: ".$_SESSION['email'];
}
?>
48
![Page 49: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/49.jpg)
signIn.php Similar to rs.php, specific to sign in function(validates data)
<!DOCTYPE html>
<?php
/**
* File: signIn.php
* Jeff Goldberg WSMS
*
* 1/2016
*/
require_once("../config.php");
require_once("rs.html");
session_start();
$email = $_POST['email'];
$pass = $_POST['Password'];
$_SESSION['email'] = $email;
if (isset($email) && $email != "") {
$link = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if ($link->connect_error) {
49
![Page 50: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/50.jpg)
die(" Error: " . $link->connect_error);
}
//encrypted password for compare to db
$salted = (sha1($pass.PW_SALT));
// is user in db and not already logged in?
$sql = 'SELECT * FROM users WHERE email="' . $email . '" AND password="'.$salted.'" AND created=0;';
$result = $link->query($sql);
$timestamp = date('Y-m-d HH:mm:ss');
$compare = (sha1($password.PW_SALT));
//find user and verify not already signed in
if ($result->num_rows > 0) {
$check_PW = sha1($pass.PW_SALT)
$sql = 'SELECT * FROM users WHERE email="' . $email . '" AND created=0;';
$result = $link->query($sql)->fetch_assoc();
// flag user as signed in
$sql = 'UPDATE users SET created= now() WHERE email="' . $email . '";';
$result = $link->query($sql);
$cmp = `password`;
50
![Page 51: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/51.jpg)
$_SESSION['email'] = $email;
$_POST['email'] = $email;
// invoke testdrag.php screen
echo "<script type='text/javascript'>window.top.location='http://localhost/medical/testdrag4.php';</script>"; exit;
} else {
$_POST['email'] = $email;
$_SESSION['email'] = $email;
echo "jeff: ".$_SESSION['email'];
}
//housekeeping and end session
//$result->close();
//$link->close();
//session_unset();
51
![Page 52: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/52.jpg)
}
?>
<html> <script>
window.alert("Invalid Signin");
</script> </font></html>
rs.html Main HTML Module (uses Bootstrap navbar structure)
<!DOCTYPE html>
<html lang="en">
<head>
<?php session_start(); ?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Response STAT</title>
<!-- Bootstrap core CSS -->
<link href="bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Cosmo Theme CSS -->
52
![Page 53: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/53.jpg)
<link href="spacelab.bootstrap.min.css" rel="stylesheet"
integrity="sha256-IF1P9CSIVOaY4nBb5jATvBGnxMn/4dB9JNTLqdxKN9w= sha512-UsfHxnPESse3RgYeaoQ7X2yXYSY5f6sB6UT48+F2GhNLqjbPhtwV2WCUQ3eQxeghkbl9PioaTOHNA+T0wNki2w=="
crossorigin="anonymous">
<!-- Custom styles for this template -->
</head>
<!-- ================ Banner ================ -->
<div class="container under-nav">
<img src="statBanner.jpg" data-toggle="modal" data-target="#outModal" alt="banner" height="90" width="1140">
</div>
<body style="background-image:url(medical/lib/background.jpg);background-repeat: no-repeat; background-size: 1400px, 650px, auto;">
<!-- <script src="https://cybermap.kaspersky.com/assets/scripts/widget.js" async defer></script> ****future use -->
<!-- ========== Register modal ========== --><!-- ========== Register modal ========== --><!-- ========== Register modal ========== -->
<div class="modal fade" id="registerModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
53
![Page 54: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/54.jpg)
<h1 class="modal-title"><font color="darkblue">Register</h1>
</div>
<div class="modal-body well">
<!-- ================ Form ================ -->
<form class="form-horizontal" method="post" action="registerIndex.php">
<div class="form-group">
<label for="firstName" class="col-sm-4 control-label">First Name</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="firstName" id="firstName"
placeholder="First Name"
required autofocus>
</div>
</div>
<div class="form-group">
<label for="lastName" class="col-sm-4 control-label">Last Name</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="lastName" id="lastName"
placeholder="Last Name" required>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-4 control-label">Email</label>
54
![Page 55: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/55.jpg)
<div class="col-sm-6">
<input type="email" class="form-control" name="email" placeholder="email" required>
</div>
</div>
<div class="form-group">
<label for="Password" class="col-sm-4 control-label">Password</label>
<div class="col-sm-6">
<input type="password" class="form-control" name="Password" placeholder="Password"
required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-5 col-sm-3">
<button type="submit" class="btn btn-primary">Register</button>
</div></div>
<div class="form-group">
<div><img src="register.jpg" height="200" width="585"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div></div></div>
55
![Page 56: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/56.jpg)
</form>
<!-- /.modal-content -->
</div> </div>
<!-- /.modal-dialog -->
</div>
<!-- ========== Log out modal ========= --><!-- ========== Log out modal ========= --><!-- ========== Log out modal ========= -->
<div class="modal fade" id="outModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h1 class="modal-title"><font color="darkblue">Logout</h1></font>
</div>
<div class="modal-body">
<!-- ================ Form ================ -->
<form class="form-horizontal" method="post" action="logout.php" id="logoutForm">
<div class="form-group">
<label for="email" class="col-sm-4 control-label"></label>
<!-- <div class="col-sm-4">
<input type="email" class="form-control" name="email" id="email2" placeholder ="CONFIRM LOGOFF" disabled>
</div> -->56
![Page 57: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/57.jpg)
</div>
<div class="form-group">
<div class="col-sm-offset-5">
<button type="submit" class="btn btn-primary">Confirm Logoff</button></br></div>
</div>
<div>
<img src="goodDay.jpg" height="300" width="560"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> </form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div></div>
<!-- ========== Batch modal ========= --><!-- ========== Batch modal ========= --><!-- ========== Batch modal ========= -->
<div class="modal fade" id="batModal">
<div class="modal-dialog">
57
![Page 58: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/58.jpg)
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title"><font color="darkblue"></h4><h1>Start Mosquito</h1>
<img src="communication-rules.jpg" height="220" width="568"></div><h4 class="modal-title"><font color="red">             <font color="white"> ....</font>Click </br>             <font color="white">....</font>initiate! </font></h4><h5> </h5><h6></h6> <h5></h5>
<div class="modal-body">
<!-- ================ Form ================ -->
<form class="form-horizontal" method="post" action="batch.php" id="batForm">
<!--<div class="form-group"> -->
<!-- <label for="email" class="col-sm-4 control-label">Email</label>
<div class="col-sm-6">
<input type="email" class="form-control" name="email" value="<?php echo $_SESSION['email'];?>" id="email" disabled>
</div>--><div class="form-group">
<div class="col-sm-offset-5">
<button type="Run" class="btn btn-primary"> <font color="white">Initiate</font></button></br>
<label for="xx" class="col-sm-4 control-label"><h6><font color="darkblue"> </h6></label></div>
58
![Page 59: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/59.jpg)
</div>
<div class="form-group">
<label for="command" class="col-sm-3 control-label"><h6><font color="darkblue"> Admin ONLY => </h6></label>
<div class="col-sm-6">
<input type="text" class="form-control" name="command" id="command" placeholder =" Batch File or Command"</br><font size="2" color="red">  <font color="white"> .............</font>NO ENTRY ABOVE</font>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- ========== Report modal ========= --><!-- ========== Report modal ========= --><!-- ========== Report modal ========= -->
<div class="modal fade" id="reportModal">59
![Page 60: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/60.jpg)
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title"><font color="darkblue"></h4><h1>Reporting</h1>
<img src="hr-report.jpg" height="220" width="568"></div><h5> </h5><h6></h6> <h5></h5>
<div class="modal-body">
<!-- ================ Form ================ -->
<form class="form-horizontal" method="post" action="jreport.php" id="reportForm">
<div class="form-group">
<div class="col-sm-offset-5">
<button type="Run" class="btn btn-primary"> <font color="white">Dispatch Query</font></button></br></br>
</div>
</div>
</form>
<form class="form-horizontal" method="post"action="kreport.php" id="reportForm2">
<div class="col-sm-offset-15">
60
![Page 61: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/61.jpg)
<button type="Run" class="btn btn-primary"> <font color="white">Dispatch Report</font></button></br></br>
</div>
</form>
<form class="form-horizontal" method="post" action="ureport.php" id="reportForm2">
<div class="col-sm-offset-5">
<button type="Run" class="btn btn-primary"> <font color="white">User ID Query</font></button></br></br>
</div>
</form>
<form class="form-horizontal" method="post" action="utreport.php" id="reportForm2">
<div class="col-sm-offset-15">
<button type="Run" class="btn btn-primary"> <font color="white">Logged In Query</font></button></br></br>
</div>
</form>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
61
![Page 62: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/62.jpg)
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- ================ NAV Bar ================ --><!-- ================ NAV Bar ================ --><!-- ================ NAV Bar ================ -->
<!-- ================ NAV Bar ================ --><!-- ================ NAV Bar ================ --><!-- ================ NAV Bar ================ -->
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" id="nav">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span><span class="icon-bar"></span>
</button>
<!-- <a class="navbar-brand" href="#">Response STAT</a> -->
<a class="navbar-brand" href="#"><h4></h4</a>
62
![Page 63: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/63.jpg)
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#" data-toggle="modal" data-target="#registerModal">Register</a></li>
<li>
<a href="#" id="login" data-toggle="modal"
data-target="#myModal">Sign In</a>
</li>
<li>
<a href="#" id="logout" data-toggle="modal"
data-target="#outModal"><!--onclick.= "$.get( 'getemail.php', function( data ) {$('#email').val(data);});$('#email').prop('disabled', true);$('#email2').val(data);});$('#email2').prop('disabled', true);"--> Logoff</a> </li>
<li><a href="rs.php">Home</a></li><li>
<a href="#" id="bat" data-toggle="modal"
data-target="#batModal">Skeeter</a> </li>
<li>
<a href="#" id="rpt" data-toggle="modal"
data-target="#reportModal">Reporting</a> </li>
<!-- <li><a href="batch.php">Batch</a></li> --><a class="navbar-brand" href="#"><h4><font color="yellow">                       Emergency Dispatch </h4></font></span></a>
</ul>
63
![Page 64: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/64.jpg)
</div>
</div>
</nav>
</div>
<!-- ================ Main img ================ --><!-- ================ Main img ================ -->
<div class="container under-nav">
<a id="login" data-toggle="modal" data-target="#myModal"><img src="jeffstat.jpg"alt="Chopper" height="680" width="1140"></a>
</div>
<!-- ========== Log in modal ========== --><!-- ========== Log in modal ========== --><!-- ========== Log in modal ========== -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h1 class="modal-title"><font color="darkblue">Log in</h1></font>
</div>
<div class="modal-body">
<!-- ================ Form ================ -->
<form class="form-horizontal" method="post" action="signIn.php" id="loginForm">
<div class="form-group">64
![Page 65: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/65.jpg)
<label for="email" class="col-sm-4 control-label">Email</label>
<div class="col-sm-6">
<input type="email" class="form-control" name="email" id="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="Password" class="col-sm-4 control-label">Password</label>
<div class="col-sm-6">
<input type="password" class="form-control" name="Password" id="Password" placeholder="Password"
required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-5">
<button type="submit" onclick="var em=$('#email').val();$('#email2').val(em);" id="jeff" class="btn btn-primary">Sign in</button>
</div>
</div>
<div>
<img src="welcome.jpg" height="200" width="550"></div>
</form>
</div>
<div class="modal-footer">
65
![Page 66: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/66.jpg)
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
</body>
</html>
66
![Page 67: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/67.jpg)
registerIndex.php User Registration (Uses front end edit to prevent SQL Injection Attacks)
<!DOCTYPE html>
<?php
/**
* registerIndex.php
*
* Jeff Goldberg WSMS 1/2016
*
Register new user
*/
require_once("../config.php");//database config
require_once("rs.html");//Homepage format
session_start();
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$pw = ($_POST['Password']);
/**67
![Page 68: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/68.jpg)
* Create a password hash
*
* @param string $password The clear text password
* @param string $salt The salt to use, or null to generate a random one
* @param int $N The CPU difficultly (must be a power of 2, > 1)
* @param int $r The memory difficultly
* @param int $p The parallel difficultly
*
* @return string The hashed password
*/
$encrypted = sha1($pw.PW_SALT);
$link = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if ($link->connect_error)
die(" Error: " . $link->connect_error);
// is user already registered in db?
$sql = "SELECT * FROM users WHERE email='" . $email . "'; ";
//register user after verifying all fields entered and not already in db
if ($link->query($sql)->num_rows == 0 && $email != '' && $firstName != '' && $lastName != '' && $encrypted != '' ) {
$sql = "INSERT INTO users( username, password, email )
VALUES ( '" .$firstName. "' ,'" . $encrypted . "','" . $email . "' );";
$link->query($sql);
68
![Page 69: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/69.jpg)
echo("<h1>Registered</h1>");
echo '<script>'; echo 'alert("Registration Successful")'; echo '</script>';
}else{
echo '<label class="text-danger"></label>';
echo '<script>'; echo 'alert("Registration Incorrect")'; echo '</script>'; // Not safe: should
$link->close();
}
?>
</html>
69
![Page 70: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/70.jpg)
logout.php Logout Functionality
<?php
/**
* File: logout.php
*
*/
require_once("../config.php");
require_once("rs.html");
require_once("../scrypt.php");
70
![Page 71: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/71.jpg)
session_start();
print_r($_SESSION);
if ($email !='') {
echo $email."....em..";
}else{
if ($_SESSION['email'] !='') {
echo "SESS jeff:".$_SESSION['email'];
$email = $_SESSION['email'];
}
}
$link = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if ($link->connect_error) {
die(" Error: " . $link->connect_error);
}
// look for matching password in db
$sql = 'SELECT * FROM users WHERE email="' . $email . '";';
$result = $link->query($sql);
71
![Page 72: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/72.jpg)
$compare = (sha1($password.PW_SALT));
// is user signed in?
if ($result->num_rows > 0) {
//$check_PW = sha1($pass.PW_SALT)
$sql = 'SELECT * FROM users WHERE email="' . $email . '" AND created !=0;';
$result = $link->query($sql)->fetch_assoc();
// sign user out
$sql = 'UPDATE users SET created= 0 WHERE email="' . $email . '" AND created !=0;';
$result = $link->query($sql);
$cmp = `password`;
$result = $link->query($sql);
$_POST['email'] = $email;
$_SESSION['email'] = $email;
} else {
$_SESSION['email'] = $email;
$_POST['email'] = $email;
}
?>
72
![Page 73: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/73.jpg)
kreport.php Dispatch Report with Inner Join of Dispatch and Hospital Tables
<?php
session_start();
require_once('/var/www/config.php');
$records_per_page = 100;
$cur_page = (int)$_GET['cur_page'];
if (!$cur_page || $cur_page == 0){
$cur_page=1;
}
73
![Page 74: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/74.jpg)
//need: host, user, password, database
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, "emetromedical");
//GET COUNT OF RECORDS
$sql_count = "SELECT count(*) AS COUNT FROM dispatch
INNER JOIN hospital ON dispatch.hospitalid=hospital.hospitalid";
$result1 = $link->query($sql_count);
foreach ($result1 as $row){
$total_records = $row['COUNT'];
}
//join query notes
//SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city, dispatch.stamp AS DispatchDateTimeStamp
//FROM dispatch, hospital
//WHERE dispatch.hospitalid = hospital.hospitalid
//run the actual query
$sql_query = "SELECT dispatch.hospitalid, hospital.name, hospital.address1, hospital.city, dispatch.stamp
FROM dispatch
INNER JOIN hospital ON dispatch.hospitalid=hospital.hospitalid
LIMIT 0,".$records_per_page;
$result = $link->query($sql_query);
//REPORT HEADER
$content = '<table width="100%"><thead><tr>';
74
![Page 75: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/75.jpg)
$content .= '<td width="20%">ID</td><td width="20%">HospitalName</td><td width="20%">Address</td><td width="20%">City</td><td width="20%">DispatchDateTime</td></thead>';
$content .= "<tbody>";
foreach($result as $row){
//COLLECT INFO FROM DB -> ASSIGN TO VARIABLES
$hospitalid = $row['hospitalid'];
$hospitalname = $row['name'];
$address = $row['address1'];
$city = $row['city'];
$dispatchdatetime = $row['stamp'];
//APPEND INFO FROM VARIABLES TO OUTPUT BUFFER/VARIABLE
$content .= "<td>".$hospitalid."</td><td>".$hospitalname."</td><td>".$address."</td><td>".$city."</td><td>".$dispatchdatetime."</td></tr>";
}
//REPORT FOOTER
$prev_page = $cur_page -1;
$next_page = $cur_page +1;
if ($cur_page > 1){
$pagination = '<a href="report.php?cur_page='.$prev_page.'"><<< Previous</a>';
}
$pagination .= ' <a href="report.php?cur_page='.$next_page.'">Next >>></a>';
$pages = ceil($total_records/$records_per_page);
$content .= '<tr><td align="center" colspan=5>'.$pagination.'</td></tr>';
$content .= '<tr><td align="center" colspan=5>Total Pages:'.$pages.'</td></tr>';
75
![Page 76: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/76.jpg)
$content .= "</tbody></table><hr>";
echo $content;
?>
76
![Page 77: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/77.jpg)
jreport.php Dispatch Table Query
<?php
/* jreport.php Dispatch table query
Jeff Goldberg WSMS 1/2016
return detail by date and timestamp
*/
require_once('database_template.php');
$database = "emetromedical";
$query = "select * from dispatch";
$result = query_db($query, $database);
foreach($result as $row){
$hospitalid = $row['hospitalid'];
//$hospitalname = $row['name']; future use - join tables
//$address = $row['address1'];
//$city = $row['city'];
$dispatchdatetime = $row['stamp'];
$dispatchipaddr = $row['ipaddr'];
77
![Page 78: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/78.jpg)
$dispatchpatient = $row['patientid'];
$options .= '<option id="' . $dispatchdatetime . '">' . $dispatchdatetime . '</option>';
}
//above loop retrieves DB detail
?>
<html>
<head>
<script src="jquery-2.1.4.min.js"></script>
<script>
$( document ).ready(function() {
$("#selector").val("Select Item");//Set dropdown to "Select Item"
$("#selector").change(function() {//generates trigger for calling db
var stamp = $("#selector").children(":selected").attr("id");//gets the value of dropdown
$.get( "inventoryj_callback.php", { stamp: stamp } ) //backend call to db, passing through sku variable
.done(function( data ) {
78
![Page 79: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/79.jpg)
console.log(data);
var returndata = $.parseJSON(data);//return order is [0]=stamp,[1]=ip,[2]=patient [3]=hospital,
console.log(' data ');
console.log(data);
console.log(returndata);
utreport.php User Table Query by Timestamp
Reports on all Signed In Users (using JSON Callback to database)
79
![Page 80: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/80.jpg)
<?php
/* utreport.php User table query
Jeff Goldberg WSMS 1/2016
return detail by timestamp
*/
require_once('database_template.php');
$database = "users";
$query = "select * from users";
$result = query_db($query, $database);
foreach($result as $row){
$username = $row['username'];
$email = $row['email'];
$created = $row['created'];
// signed in user will have a positive timestamp
if ($created > 0) {
80
![Page 81: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/81.jpg)
$options .= '<option id="' . $created . '">' . $username . '</option>';
}
}
//above loop retrieves DB detail
?>
<html>
<head>
<script src="jquery-2.1.4.min.js"></script>
<script>
$( document ).ready(function() {
$("#selector").val("Select Item");//Set dropdown to "Select Item"
$("#selector").change(function() {//generates trigger for calling db
var created = $("#selector").children(":selected").attr("id");//gets the value of dropdown
$.get( "usertCallback.php", { created: created } ) //backend call to db, passing through user signon variable
.done(function( data ) {
var returndata = $.parseJSON(data);//return order is [0]=username,[1]=email,[2]=created
console.log(' data ');
console.log(data);
81
![Page 82: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/82.jpg)
console.log(returndata);
$("#username").val(returndata[0]);
$("#email").val(returndata[1]);
$("#created").val(returndata[2]);
});
});
});
</script>
</head>
<body>
<center><font color=blue><h1>Users Table Query</h1></font></center>
<center><font color=gray><h2>by User Signin Status</h2></font></center><br /><br /><br /><br /><br />
<!-- Date - select<br /><br /> -->
<center>
<select id="selector"><option id="0" selected="selected">Select Item</option></center><br /><br />
<?php
echo $options;
?>
82
![Page 83: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/83.jpg)
</select>
<br />
<br />
<br />
<br />
User Signin Status:<br /><br /><br />
<font color=blue>
User ID :   <input id="username" value=""><br /><br />
eMail :   <input id="email" value=""><br /><br />
Signed In: <input id="created" value=""><br /><br />
<br /><br /><br /></br><br /><br /><br />
</font>
<div id="imgHolder"></div>
<a class="btn" href="../logout.php">
<button class="btn" type="submit">Close</button></a></br><br /><br /><br /></br><br /><br /><br /></br><br /><br /><br /></br><br /><br /><br />
</body>
</html>
<?php
usertCallback.php json callback for required detail83
![Page 84: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/84.jpg)
// JSON Callback to database for specific row detail
//
// Jeff Goldberg WSMS 1/2016
//
// usertCallback.php component of ureport.php
//
require_once('database_template.php');
$database = "users";
$created = $_GET['created'];
$query = "SELECT * FROM users WHERE created ='".$created."'";
$results = query_db($query, $database);
foreach($results as $row){
$aryDetails[0] = $row['username'];
$aryDetails[1] = $row['email'];
$aryDetails[2] = $row['created'];
}
echo json_encode($aryDetails);
84
![Page 85: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/85.jpg)
?>
ureport.php User Table Query
Reports on Registered Users (using JSON Callback to database)
<?php
/* ureport.php User table query85
![Page 86: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/86.jpg)
Jeff Goldberg WSMS 1/2016
return detail by username
*/
require_once('database_template.php');
$database = "users";
$query = "select * from users";
$result = query_db($query, $database);
foreach($result as $row){
$username = $row['username'];
$email = $row['email'];
$created = $row['created'];
$options .= '<option id="' . $username . '">' . $username . '</option>';
}
//above loop retrieves DB detail
?>
<html>
<head>
<script src="jquery-2.1.4.min.js"></script>
<script>
86
![Page 87: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/87.jpg)
$( document ).ready(function() {
$("#selector").val("Select Item");//Set dropdown to "Select Item"
$("#selector").change(function() {//generates trigger for calling db
var username = $("#selector").children(":selected").attr("id");//gets the value of dropdown
$.get( "userCallback.php", { username: username } ) //backend call to db, passing through sku variable
.done(function( data ) {
console.log(' pr1-data ');
console.log(data);
var returndata = $.parseJSON(data);//return order is [0]=username,[1]=email,[2]=created
console.log(' data ');
console.log(data);
console.log(returndata);
$("#username").val(returndata[0]);
$("#email").val(returndata[1]);
$("#created").val(returndata[2]);
});
});
});
</script>
</head>
<body>
<center><font color=blue><h1>Users Table Query</h1></font></center>
<center><font color=gray><h2>by User</h2></font></center><br /><br /><br /><br /><br />
87
![Page 88: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/88.jpg)
<!-- Date - select<br /><br /> -->
<center>    
<select id="selector"><option id="0" selected="selected">Select Item</option></center><br /><br />
<?php
echo $options;
?>
</select>
<br />
<br />
<br />
<br />
   User Details:<br /><br />
<font color=blue>
User:    <input id="username" value=""><br /><br />
eMail add:  <input id="email" value=""><br /><br />
Signed In:  <input id="created" value=""><br /><br />
<br /><br /><br /></br><br /><br /><br />
</font>
<div id="imgHolder"></div>
<a class="btn" href="../logout.php">
88
![Page 89: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/89.jpg)
<button class="btn" type="submit">Close</button></a></br><br /><br /><br /></br><br /><br /><br /></br><br /><br /><br /></br><br /><br /><br />
</body>
</html>
userCallback.php json callback for required detail
<?php
// JSON Callback to database for specific row detail
//
// Jeff Goldberg WSMS 1/2016
//
// userCallback.php component of ureport.php
//
require_once('database_template.php');
$database = "users";
$username = $_GET['username'];
$query = "SELECT * FROM users WHERE username ='".$username."'";
$results = query_db($query, $database);
foreach($results as $row){
$aryDetails[0] = $row['username'];
$aryDetails[1] = $row['email'];
$aryDetails[2] = $row['created'];89
![Page 90: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/90.jpg)
}
echo json_encode($aryDetails);
?>
User Database User Table
Password Salted and Encrypted
90
![Page 91: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/91.jpg)
Batch Processing
91
![Page 92: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/92.jpg)
Admin User NOT Signed In - BLOCKED
92
![Page 93: Capstone Website project - walkthru begins P40](https://reader035.vdocument.in/reader035/viewer/2022062412/588829141a28ab733a8b5a6b/html5/thumbnails/93.jpg)
Admin Signed In Executes lshw
93