Backing up work

This commit is contained in:
Steven Tracey 2025-07-08 23:56:37 -04:00
parent 034735de19
commit fd0211efce
12 changed files with 307 additions and 0 deletions

12
.idea/LuggageTracker.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/LuggageTracker.iml" filepath="$PROJECT_DIR$/.idea/LuggageTracker.iml" />
</modules>
</component>
</project>

20
.idea/php.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.3" />
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

22
home.php Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Luggage Tracker</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/header.php" ?>
<div class="container">
<div class="content flex-vertical">
<h3>Registration</h3>
<p>Contact Steven Tracey
<a class="contact-link" href="mailto:steven@nevets.tech?subject=QR%20Generator%20-%20(Your%20Name)&body=Name%3A%0APhone%20Number%3A%0AEmail%20Address%3A%0AMailing%20Address%3A%0AStreet%3A%0ACity%3A%0AZip%3A%0AState%3A%0ACountry%3A">via email</a>
to get your QR code</p>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/footer.php" ?>
</body>
</html>

4
snippets/footer.php Normal file
View File

@ -0,0 +1,4 @@
<?php ?>
<footer class="footer">
<p class="footer-text">Made hastily by <a class="footer-text" href="https://www.linkedin.com/in/steven-tracey18/">Steven Tracey</a></p>
</footer>

7
snippets/header.php Normal file
View File

@ -0,0 +1,7 @@
<?php ?>
<header class="header">
<img class="header-icon" src="/static/icon.png" alt="icon"/>
<h1 class="title">Luggage Tracker</h1>
<div class="spacer"></div>
</header>

BIN
static/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

166
static/style.css Normal file
View File

@ -0,0 +1,166 @@
:root {
--dark: #1f363dff;
--dark-click: #152429;
--mid-dark: #40798cff;
--mid: #70a9a1ff;
--mid-light: #9ec1a3ff;
--light: #cfe0c3ff;
font-family: Verdana,sans-serif;
}
body {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: space-between;
background-color: var(--mid-dark);
padding: 0 1rem;
height: 80px;
}
.spacer {
flex: 0 0 64px;
}
.header-icon {
display: block;
flex: 0 0 64px;
width: 15vw;
height: auto;
max-height: 80px;
}
.title {
flex: 1;
text-align: center;
color: var(--light);
}
.footer {
background-color: var(--dark);
display: flex;
flex: 0 0 auto;
height: 80px;
}
.footer-text {
display: inherit;
align-content: center;
justify-content: center;
margin: auto;
background-color: inherit;
border: none;
outline: none;
text-align: center;
color: white;
}
.footer-text a {
cursor: pointer;
text-decoration: none;
color: var(--mid-light);
padding-left: 5px;
}
.footer-text a:hover {
color: var(--mid);
}
.contact-link {
cursor: pointer;
color: var(--mid-dark);
text-decoration: none;
}
.contact-link a:hover {
color: var(--mid);
}
.container {
flex: 1 0 auto;
display: flex;
justify-content: center;
align-items: center;
padding: 0;
background-image: linear-gradient(
to bottom right,
var(--mid-light),
var(--mid-dark)
);
}
.content {
display: flex;
width: 90vw;
max-width: 800px;
padding: 1.5rem;
background: white;
border-radius: 5px;
text-align: center;
}
.content h3 {
text-align: center;
}
.content p {
text-align: center;
}
.content input {
font-size: 16px;
}
.content button {
color: var(--dark);
background-color: var(--light);
border-radius: 8px;
border: 2px solid;
border-color: var(--dark);
padding: 8px 12px;
text-align: center;
text-decoration: none;
font-size: 16px;
cursor: pointer;
}
.content button:hover {
color: var(--light);
background-color: var(--dark);
}
.content button:active {
background-color: var(--dark-click);
}
.flex-vertical {
flex-direction: column;
}
.flex-horizontal {
flex-direction: row;
}
.hidden {
display: none;
}
.section-one {
flex: 0 0 auto;
}
.section-two {
display: flex;
flex: 1 0 auto;
}
#status {
margin-bottom: 0;
}

35
static/verify.js Normal file
View File

@ -0,0 +1,35 @@
let baseUrl = "http://localhost:8000"
document.getElementById("submitBtn").addEventListener('click', function(e) {
let code = document.getElementById("code").value;
console.log("Clicked: " + code);
const path = window.location.pathname;
const parts = path.split("/");
//const user = parts.pop();
const user = "tracey"
fetch(baseUrl + "/api/verify/" + user, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': "Basic " + code,
}
}).then(response => response.json())
.then(data => {
let statusText = document.getElementById("status");
console.log(data);
statusText.classList.remove("hidden");
if (data.status === 404) {
// Not found
statusText.innerText = "User with that code not found";
} else if (data.status === 200) {
// Display found and redirect to baseUrl/u/user/info with auth token
statusText.innerText = "User found, redirecting...";
window.location.replace(baseUrl + "/u/" + user + "/info")
} else {
// Error
statusText.innerText = "Error, please send this to Steven to be fixed. Error: " + data.error;
}
})
})

27
verify.php Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Luggage Tracker</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/header.php" ?>
<div class="container">
<div class="content flex-vertical">
<div class="section-one flex-horizontal">
<label for="code">Secret Code (SC):</label>
<input id="code" type="text">
<button id="submitBtn">Submit</button>
</div>
<div class="section-two flex-vertical">
<p id="status" class="hidden">Text</p>
</div>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/footer.php" ?>
<script src="/static/verify.js"></script>
</body>
</html>