Project uploaded for storage and access.

This commit is contained in:
serialexperiments0815 2025-11-28 15:14:31 +01:00
parent c103b1e1a6
commit 9c573e1f7f
15 changed files with 568 additions and 0 deletions

53
Database_creator.sql Normal file
View file

@ -0,0 +1,53 @@
/*
DROP TABLE IF EXISTS Record_details, Outstanding_warrants, Criminal_summary, Person_summary;
DROP DATABASE IF EXISTS Serial_enforcing_interface_database;
*/
CREATE DATABASE IF NOT EXISTS serial_enforcing_interface_database;
USE serial_enforcing_interface_database;
CREATE TABLE IF NOT EXISTS person_summary (
person_number int AUTO_INCREMENT NOT NULL,
picture varchar(50) NOT NULL,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
middle_name varchar(50),
date_of_birth date NOT NULL,
state_of_residence varchar(50),
CONSTRAINT PRIMARY KEY (person_number)
);
CREATE TABLE IF NOT EXISTS criminal_summary (
person_number_criminal_summary int NOT NULL,
charges int NOT NULL,
convictions int NOT NULL,
outstanding_warrants int NOT NULL,
flight_risk varchar(3) NOT NULL,
CONSTRAINT FK1 FOREIGN KEY (person_number_criminal_summary) REFERENCES person_summary (person_number)
);
CREATE TABLE IF NOT EXISTS outstanding_warrants (
person_number_outstanding_warrants int NOT NULL,
date_issues date NOT NULL,
charge varchar(50) NOT NULL,
country_state varchar(20) NOT NULL,
CONSTRAINT FK2 FOREIGN KEY (person_number_outstanding_warrants) REFERENCES person_summary (person_number)
);
CREATE TABLE IF NOT EXISTS record_details (
person_number_record_details int NOT NULL,
offense_date date NOT NULL,
offense varchar(200) NOT NULL,
disposition_outcome varchar(200) NOT NULL,
offense_location_prefix char(10) NOT NULL,
offense_location_street_number int(10) NOT NULL,
offense_location_street_name char(20) NOT NULL,
offense_location_street_type char(20) NOT NULL,
offense_location_unit char(30),
offense_location_city char(30) NOT NULL,
offense_location_state char(10) NOT NULL,
offense_location_zip_code int(10),
offense_location_county char(50),
sentence_penalty varchar(100) NOT NULL,
charge_type varchar(50) NOT NULL,
CONSTRAINT FK3 FOREIGN KEY (person_number_record_details) REFERENCES person_summary (person_number)
);

BIN
Images/Gabrielle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
Images/Jack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
Images/John.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

4
Sample_profiles.sql Normal file
View file

@ -0,0 +1,4 @@
USE serial_enforcing_interface_database;
insert into person_summary(picture, first_name, last_name, middle_name, date_of_birth, state_of_residence) VALUES ('John.png', 'John', 'Smith', NULL, DATE_SUB(SYSDATE(), INTERVAL 120 MONTH), 'California');
insert into person_summary(picture, first_name, last_name, middle_name, date_of_birth, state_of_residence) VALUES ('Jack.png', 'Jack', 'Park', NULL, DATE_SUB(SYSDATE(), INTERVAL 50 MONTH), 'Texas');
insert into person_summary(picture, first_name, last_name, middle_name, date_of_birth, state_of_residence) VALUES ('Gabrielle.png', 'Gabrielle', 'Adams', NULL, DATE_SUB(SYSDATE(), INTERVAL 250 MONTH), 'New York');

48
catalog.php Normal file
View file

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<?php
include('database_connection.txt');
$conn = mysqli_connect($host, $user, $password, $db) or die("database connection has failed");
$query = "select * from person_summary";
$result = mysqli_query($conn, $query) or die("query has failed");
?>
<html>
<head>
<title>Catalog</title>
<link rel="stylesheet" href="graphics.css">
</head>
<body>
<div class="container-column">
<div class="block_text">
<h1>Catalog of persons</h1>
</div>
<div class="block">
<div class="container-row">
<?php
while ($row = mysqli_fetch_object($result)) {
ECHO" <div class='container-column'>
<div class='block_image'>
<img src='Images/", $row -> picture,"'/>
</div>
<div class='block_image_text'>
<p>", $row -> first_name,"</p>
</div>
</div>";
}
?>
</div>
</div>
</body>
</html>
<?php
mysqli_close($conn);
?>

6
database_connection.txt Normal file
View file

@ -0,0 +1,6 @@
<?php
$host = "localhost";
$user = "root";
$password = "";
$db = "serial_enforcing_interface_database"
?>

0
exiting.php Normal file
View file

83
graphics.css Normal file
View file

@ -0,0 +1,83 @@
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html, body {
height:100%;
margin: 0;
padding: 0;
}
.block {
border: 1px solid black;
height: 100vh;
width: 100%;
}
.block_quarter {
border: 1px solid black;
height: 25vh;
width: 100%;
}
.block_text {
border: 1px solid black;
height: 25vh;
width: 100%;
text-align: center;
justify-content: center;
align-items: center;
display: flex;
}
.block_image {
border: 1px solid black;
height: 25vh;
width: 100%;
justify-content: top;
align-items: top;
display: flex;
}
.block_text img {
top: 0px;
height: 100%;
width: 100%;
object-fit: contain;
}
.block_image_text {
border: 1px solid black;
text-align:center;
height: relative;
width: 100%;
}
.container-row {
display: flex;
flex-direction: row;
height: 100vh;
}
.container-column {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
.container-column-group {
display:flex;
flex-direction: column;
margin-left: 10%;
margin-right: 10%;
overflow: hidden;
}

39
main_site.html Normal file
View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>Enforcing Interface landing page</title>
<link rel="stylesheet" href="graphics.css">
</head>
<body>
<!-- Entire page divided into two via container-row class-->
<div class="container-row">
<div class="block"></div>
<!-- Right half divided into two seperate columns-->
<div class="block">
<div class="container-column">
<!-- Title of project -->
<div class="block_quarter">
<div class="block_text">
<h1> Welcome to the Interface </h1>
</div>
</div>
<!-- Seperate sub-columns for menu -->
<div class="block">
<div class="container-column">
<div class="block_text"><a href="catalog.php"> <h2>View Profiles</h2></a></div>
<div class="block_text"><a href="profile_create.php">Create Profile</a></div>
<div class="block_text"><a href="profile_change.php">Change Profile</a></div>
<div class="block_text"><a href="profile_delete.php">Delete Profile</a></div>
<div class="block_text"><a href="exiting.php">Exit</a></div>
<div class="block"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

0
profile_change.php Normal file
View file

54
profile_create.php Normal file
View file

@ -0,0 +1,54 @@
<html>
<head>
<title>Profile creation</title>
<link rel="stylesheet" href="graphics.css">
</head>
<body>
<div class="block_text">
<h1>Create a profile</h1>
</div>
<div class="block_image_text">
<form action="profile_create_next.php" method="POST" enctype="multipart/form-data" id="theform">
<br>
<p>Picture:</p>
<input name="person_picture" type="file">
<p>First name:</p>
<input name="first_name">
<p>Middle name:</p>
<input name="middle_name">
<p>Last name:</p>
<input name="last_name">
<p>Date of birth:</p>
<input name="date_of_birth" type="date">
<p>State of residence:</p>
<select name="state_of_residence" form="theform">
<?php
$state_of_residence = [
'ALABAMA', 'ALASKA', 'ARIZONA', 'ARKANSAS', 'CALIFORNIA',
'COLORADO', 'CONNECTICUT', 'DELAWARE', 'FLORIDA', 'GEORGIA',
'HAWAII', 'IDAHO', 'ILLINOIS', 'INDIANA', 'IOWA',
'KANSAS', 'KENTUCKY', 'LOUISIANA', 'MAINE', 'MARYLAND',
'MASSACHUSETTS', 'MICHIGAN', 'MINNESOTA', 'MISSISSIPPI', 'MISSOURI',
'MONTANA', 'NEBRASKA', 'NEVADA', 'NEW HAMPSHIRE', 'NEW JERSEY',
'NEW MEXICO', 'NEW YORK', 'NORTH CAROLINA', 'NORTH DAKOTA', 'OHIO',
'OKLAHOMA', 'OREGON', 'PENNSYLVANIA', 'RHODE ISLAND', 'SOUTH CAROLINA',
'SOUTH DAKOTA', 'TENNESSEE', 'TEXAS', 'UTAH', 'VERMONT',
'VIRGINIA', 'WASHINGTON', 'WEST VIRGINIA', 'WISCONSIN', 'WYOMING'
];
foreach ($state_of_residence as $state){
ECHO "<option value=\"{$state}\">{$state}</option>\n ";
}
?>
</select>
<br>
<input type="hidden" name="form_origin" value="profile_create">
<button type="submit">NEXT</button>
<br>
</form>
</div>
</body>
</html>

277
profile_create_next.php Normal file
View file

@ -0,0 +1,277 @@
<?php
// start the session to store data across pages
session_start();
// Check if the session variable for record entries list exists, if not, initialize it
if (!isset($_SESSION['record_entries_list'])) {
$_SESSION['record_entries_list'] = [];
}
// Assign form_origin to variable to determine from which pages this page was called
$var_recieved_from = $_POST['form_origin'];
// If the pages called by basic profile creation assign profile data and move picture into image/dir
//--------------------------------------------------------------------------------------\\
if ($var_recieved_from === 'profile_create') {
$var_person_picture = $_FILES['person_picture'];
$var_first_name = $_POST['first_name'];
$var_middle_name = $_POST['middle_name'];
$var_last_name = $_POST['last_name'];
$var_date_of_birth = $_POST['date_of_birth'];
$var_state_of_residence = $_POST['state_of_residence'];
$var_directory = "Images/";
$var_target_file = $var_directory.basename($_FILES["person_picture"]["name"]);
move_uploaded_file($_FILES["person_picture"]["tmp_name"], $var_target_file);
} elseif ($var_recieved_from === 'profile_create_next') {
$var_target_file = $_POST['person_picture'];
$var_directory = "Images/";
$var_first_name = $_POST['first_name'];
$var_middle_name = $_POST['middle_name'];
$var_last_name = $_POST['last_name'];
$var_date_of_birth = $_POST['date_of_birth'];
$var_state_of_residence = $_POST['state_of_residence'];
$new_entry = [
'id' => count($_SESSION['record_entries_list']) + 1, // Unique ID for the entry
'offense date' => $_POST['offense_date'],
'type of offense' => $_POST['type_of_offense'],
'disposition outcome' => $_POST['disposition_outcome'],
'offense location prefix' => $_POST['offense_location_prefix'],
'offense location street number' => $_POST['offense_location_street_number'],
'offense location street name' => $_POST['offense_location_street_name'],
'offense location street type' => $_POST['offense_location_street_type'],
'offense location unit' => $_POST['offense_location_unit'],
'offense location city' => $_POST['offense_location_city'],
'offense location state' => $_POST['offense_location_state'],
'offense location zip code' => $_POST['offense_location_zip_code'],
'offense location county' => $_POST['offense_location_county']
];
$_SESSION['record_entries_list'][] = $new_entry; // Add the new entry to the session list
}
//--------------------------------------------------------------------------------------\\
// Multidimensional list reponsible for storing criminal record entries until they are sent
//--------------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------------\\
function renderOffenseTypeOption() {
$offenseTypes = [
'Animal Cruelty','Arson','Assault','Battery','Bribery',
'Burglary','Child Abuse','Child Pornography','Conspiracy','Contempt of Court',
'Cybercrime','Disorderly Conduct','Domestic Violence','Driving Under the Influence (DUI)',
'Driving Without a License','Embezzlement','Escape','Extortion','Forgery','Fraud','Hate Crime',
'Homicide','Human Trafficking','Identity Theft','Illegal Weapons Possession','Kidnapping','Larceny',
'Manslaughter','Money Laundering','Obstruction of Justice','Perjury','Public Intoxication','Resisting Arrest',
'Robbery','Sexual Assault','Shoplifting','Smuggling','Solicitation','Soliciting Prostitution','Stalking',
'Tax Evasion','Terrorism','Theft','Trespassing','Violation of Probation'
];
foreach($offenseTypes as $offense){
echo "<option value=\"{$offense}\">{$offense}</option>\n ";
}
}
function renderDispositionOutcomes() {
$dispositionOutcomes = ['Acquittal','Amnesty','Charges dropped/No charges filed','Commutation',
'Convicted','Deferred Prosecution','Dismissal','Expungement','Pardon','Pending','Reprieve',
'Sealed','Suspended sentence','Vacated'
];
foreach($dispositionOutcomes as $disposition){
echo "<option value=\"{$disposition}\">{$disposition}</option>\n ";
}
}
function renderOffenseLocationState() {
$offenseLocation = [
'ALABAMA','ALASKA','ARIZONA','ARKANSAS','CALIFORNIA','COLORADO','CONNECTICUT','DELAWARE','FLORIDA',
'GEORGIA','HAWAII','IDAHO','ILLINOIS','INDIANA','IOWA','KANSAS','KENTUCKY','LOUISIANA','MAINE',
'MARYLAND','MASSACHUSETTS','MICHIGAN','MINNESOTA','MISSISSIPPI','MISSOURI','MONTANA','NEBRASKA',
'NEVADA','NEW HAMPSHIRE','NEW JERSEY','NEW MEXICO','NEW YORK','NORTH CAROLINA','NORTH DAKOTA',
'OHIO','OKLAHOMA','OREGON','PENNSYLVANIA','RHODE ISLAND',
'SOUTH CAROLINA','SOUTH DAKOTA','TENNESSEE','TEXAS',
'UTAH','VERMONT','VIRGINIA','WASHINGTON',
'WEST VIRGINIA','WISCONSIN','WYOMING'];
foreach ($offenseLocation as $location) {
echo "<option value=\"{$location}\">{$location}</option>\n ";
}
}
function renderOffenseLocationStreetType() {
$OffenseLocationStreetType = [
'Avenue','Boulevard','Circle','Court','Drive','Highway',
'Lane','Parkway','Place','Road','Street','Terrace','Trail','Way'
];
foreach ( $OffenseLocationStreetType as $location) {
echo "<option value=\"{$location}\">{$location}</option>\n ";
}
}
function criminalRecordEntries() {
// Display the list of criminal record entries
// if (empty($_SESSION['record_entries_list'])) {
// echo '<p>No criminal record entries found.</p>';
// } else {
// echo '<p>Criminal Record Entries:</p>';
// Loop through each entry and display its details
foreach ($_SESSION['record_entries_list'] as $new_entry) {
echo '<div class="block_image_text">';
// Display each entry's details
echo '<p>Offense Date: ', htmlspecialchars($new_entry['offense_date']), '</p>';
echo '<p>Type of Offense: ', htmlspecialchars($new_entry['type_of_offense']), '</p>';
echo '<p>Disposition Outcome: ', htmlspecialchars($new_entry['disposition_outcome']), '</p>';
echo '<p>Offense Location: ', htmlspecialchars($new_entry['offense_location_prefix']), ' ',
htmlspecialchars($new_entry['offense_location_street_number']), ' ',
htmlspecialchars($new_entry['offense_location_street_name']), ' ',
htmlspecialchars($new_entry['offense_location_street_type']), ' ',
htmlspecialchars($new_entry['offense_location_unit']), ', ',
htmlspecialchars($new_entry['offense_location_city']), ', ',
htmlspecialchars($new_entry['offense_location_state']), ' ',
htmlspecialchars($new_entry['offense_location_zip_code']), ' ',
htmlspecialchars($new_entry['offense_location_county']), '</p>';
};
}
function renderProfileDisplay(
$var_directory, $var_target_file, $var_first_name,
$var_middle_name, $var_last_name, $var_date_of_birth,
$var_state_of_residence) {
echo '<img src="', htmlspecialchars($var_directory),htmlspecialchars(basename($var_target_file)),'"></img> <br>';
echo ' <div class="block_image_text">';
echo ' <p> FIRST NAME: </p>', $var_first_name,' <br>';
echo ' <p> MIDDLE NAME: </p>', $var_middle_name,' <br>';
echo ' <p> LAST NAME: </p>', $var_last_name,' <br>';
echo ' <p> DATE OF BIRTH: </p>', $var_date_of_birth,' <br>';
echo ' <p> STATE OF RESIDENCE: </p>', $var_state_of_residence;
echo ' </div>';
}
?>
<html>
<head>
<title>Criminal Profile</title>
<link rel="stylesheet" href="graphics.css">
</head>
<body>
<div class="block_text">
<h1>Create a profile</h1>
</div>
<?php
echo '<div class="container-row">';
echo '<div class="container-column">';
echo '<div class="block_image_text">';
echo '</div>';
renderProfileDisplay($var_directory, $var_target_file, $var_first_name, $var_middle_name, $var_last_name, $var_date_of_birth, $var_state_of_residence);
echo '</div>';
echo '<div class="block_image_text">';
echo '<h1>Add criminal record entry</h1> <br>';
echo '<form action="profile_create_next.php" method="POST" enctype="multipart/form-data" id="theform">';
echo '<h2>Date of offense</h2><input name="offense_date[]" type="date"><br><br>';
echo '<h2>Type of offense</h2>';
echo '<select name="type_of_offense[]" form="theform">';
renderOffenseTypeOption();
echo '</select><br><br>';
echo '<h2>Disposition outcome</h2>';
echo '<select name="disposition_outcome[]" form="theform">';
renderDispositionOutcomes();
echo '</select><br><br>';
echo '<div class="container-column-group">';
echo '<h2>Location of offense</h2>';
echo 'Precisation of location';
echo '<select name="offense_location_prefix[]" form="theform">';
echo '<option value="at">AT</option>';
echo '<option value="in">IN</option>';
echo '<option value="near">NEAR</option>';
echo '</select><br>';
echo 'street number';
echo '<input name="offense_location_street_number[]" type="number"><br>';
echo 'street name';
echo '<input name="offense_location_street_name[]" type="text"><br>';
echo 'street type';
echo '<select name="offense_location_street_type[]" form="theform">';
renderOffenseLocationStreetType();
echo '</select><br>';
echo 'street unit (optional)';
echo '<input name="offense_location_unit[]"><br>';
echo 'city';
echo '<input name="offense_location_city[]"><br>';
echo 'state';
echo '<select name="offense_location_state[]" form="theform">';
renderOffenseLocationState();
echo '</select><br>';
echo 'zip code (optional)';
echo '<input name="offense_location_zip_code[]" type="number"><br>';
echo 'county (optional)';
echo '<input name="offense_location_county[]" type="text"><br>';
echo '<input type="hidden" name="form_origin" value="profile_create_next">';
echo '<input type="hidden" name="first_name" value="', htmlspecialchars($var_first_name), '">';
echo '<input type="hidden" name="middle_name" value="', htmlspecialchars($var_middle_name), '">';
echo '<input type="hidden" name="last_name" value="', htmlspecialchars($var_last_name), '">';
echo '<input type="hidden" name="date_of_birth" value="', htmlspecialchars($var_date_of_birth), '">';
echo '<input type="hidden" name="state_of_residence" value="', htmlspecialchars($var_state_of_residence), '">';
echo '<input type="hidden" name="person_picture" value="', htmlspecialchars($var_target_file), '">';
echo '<div>';
echo '<br>';
echo '<br>';
echo '<input type="submit" name="form_origin" value="profile_create_next">';
echo '</div>';
echo '</div>';
echo '</form>';
echo '</div>';
echo '<div class="block_image_text">';
echo '<h1>Criminal record entries</h1> <br>';
echo '<form action="profile_finish.php" method="POST">';
if (isset($_SESSION['record_entries_list'])){
criminalRecordEntries();
} else {
echo '<p>No criminal record entries found.</p>';
}
// Loop through each entry and display its details
echo '</div>';
echo '<div><input type="submit" value="Finish Profile Creation"></div>';
echo '</div>';
echo '</body>';
echo '</html>';
?>

0
profile_delete.php Normal file
View file

4
profile_finish.php Normal file
View file

@ -0,0 +1,4 @@
<?php
$_SESSION = [];
session_destroy();
?>