Large commit, multiple projects/labs

This commit is contained in:
2026-04-13 16:19:41 -04:00
parent 942da76704
commit e2aa277aaf
1261 changed files with 180663 additions and 0 deletions
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Lab 7 Levi McLean</title>
</head>
<body>
<div>
<form>
<label for="fname">First Name</label>
<input type="text" name="fname"><br>
<label for="lname">Last Name</label>
<input type="text" name="lname"><br>
<label for="email">Email</label>
<input type="email" name="email"><br>
<label for="password">Password</label>
<input type="password" name="password"><br>
<label for="address">Address</label>
<input type="text" name="address"><br>
<label for="city">City</label>
<input type="text" name="city"><br>
<label for="country">Country</label>
<input type="text" name="country"><br>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
@@ -0,0 +1,58 @@
CREATE DATABASE IF NOT EXISTS `lab7` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
USE `lab7`;
-- MySQL dump 10.13 Distrib 8.0.44, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: lab7
-- ------------------------------------------------------
-- Server version 5.5.5-10.4.32-MariaDB
/*!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 */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `registration`
--
DROP TABLE IF EXISTS `registration`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `registration` (
`reg_id` int(11) NOT NULL,
`fname` varchar(30) NOT NULL,
`lname` varchar(30) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`city` varchar(30) NOT NULL,
`country` varchar(30) NOT NULL,
PRIMARY KEY (`reg_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `registration`
--
LOCK TABLES `registration` WRITE;
/*!40000 ALTER TABLE `registration` DISABLE KEYS */;
/*!40000 ALTER TABLE `registration` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2026-04-01 19:11:27
@@ -0,0 +1,25 @@
<?php
$databaseHost = 'localhost'; // localhost
$databaseName = 'lab7'; // your db_name
$databaseUsername = 'root'; // root by default for localhost
$mysqli = mysqli_connect($databaseHost, $databaseUsername, $databaseName);
?>
<?php
if(isset($_POST['submit']))
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$password = $_POST['password'];
$address = $_POST['address'];
$city = $_POST['city'];
$country = $_POST['country'];
$result = mysqli_query($mysqli,"insert into user values('','$fname','$lname','$email','$password','$address','$city','$country')");
if($result) {
echo "Registration Successfully";
}
else {
echo "failed:";
}
}
?>
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Lab 7 Levi McLean</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div>
<form method="post" action="action.php">
<label for="fname">First Name</label>
<input type="text" name="fname"><br>
<label for="lname">Last Name</label>
<input type="text" name="lname"><br>
<label for="email">Email</label>
<input type="email" name="email"><br>
<label for="password">Password</label>
<input type="password" name="password"><br>
<label for="address">Address</label>
<input type="text" name="address"><br>
<label for="city">City</label>
<input type="text" name="city"><br>
<label for="country">Country</label>
<input type="text" name="country"><br>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
@@ -0,0 +1,6 @@
body {
font-family: Arial, Helvetica, sans-serif;
color: black;
font-weight: bold;
background-color: darkred;
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,125 @@
/*
Create and use database Rebu
*/
CREATE DATABASE IF NOT EXISTS Rebu;
USE Rebu;
/*
Create table for drivers
*/
DROP TABLE IF EXISTS drivers;
CREATE TABLE IF NOT EXISTS drivers(
driver_id INT NOT NULL PRIMARY KEY,
salutation VARCHAR(3) NOT NULL,
fname VARCHAR(30) NOT NULL,
lname VARCHAR(30) NOT NULL,
`address` VARCHAR(100) NOT NULL,
phone VARCHAR(20) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
insurance_provider VARCHAR(30) NOT NULL,
policy_number VARCHAR(15) NOT NULL UNIQUE,
speeding_tickers INT,
accidents INT
);
/*
Create table for vehicles, in case a driver has two or more
*/
DROP TABLE IF EXISTS vehicles;
CREATE TABLE IF NOT EXISTS vehicles(
vehicle_id INT NOT NULL PRIMARY KEY,
driver_id INT NOT NULL,
vehicle_make VARCHAR(30) NOT NULL,
vehicle_model VARCHAR(30) NOT NULL,
vehicle_year VARCHAR(4) NOT NULL,
license_plate VARCHAR(7) NOT NULL,
FOREIGN KEY (driver_id) REFERENCES drivers(driver_id)
);
/*
Create table for payment cards, in case rider has multiple
*/
DROP TABLE IF EXISTS cards;
CREATE TABLE IF NOT EXISTS cards(
card_id INT NOT NULL PRIMARY KEY,
rider_id INT NOT NULL,
card_number VARCHAR(12) NOT NULL,
card_name VARCHAR(100) NOT NULL,
card_expiry VARCHAR(12) NOT NULL,
FOREIGN KEY (rider_id) REFERENCES riders(rider_id)
);
/*
Create table for riders
*/
DROP TABLE IF EXISTS riders;
CREATE TABLE IF NOT EXISTS riders(
rider_id INT NOT NULL PRIMARY KEY,
`address` VARCHAR(100) NOT NULL,
phone VARCHAR(20) NOT NULL UNIQUE
);
/*
Create table for the actual ride information
*/
DROP TABLE IF EXISTS rides;
CREATE TABLE IF NOT EXISTS rides(
ride_id INT NOT NULL PRIMARY KEY,
pickup_location VARCHAR(100) NOT NULL,
pickup_date DATE NOT NULL,
pickup_time TIME NOT NULL,
dropoff_location VARCHAR(100) NOT NULL,
base_cost DECIMAL(5,2) NOT NULL,
hst DECIMAL(5,2) GENERATED ALWAYS AS (ROUND(base_cost * 0.13,2)) STORED,
total_cost DECIMAL(5,2) GENERATED ALWAYS AS (ROUND(base_cost * 1.13,2)) STORED,
driver_id INT NOT NULL,
driver_satisfaction INT NOT NULL CHECK (driver_satisfaction BETWEEN 1 AND 5),
rider_id INT NOT NULL,
card_id INT NOT NULL,
FOREIGN KEY (driver_id) REFERENCES drivers(driver_id),
FOREIGN KEY (card_id) REFERENCES cards(card_id)
);
/*
Some simple select and join statements for testing and demonstration purposes
*/
INSERT INTO drivers VALUES
(1, 'Mr', 'John', 'Doe', '123 Main St', '111-111-1111', 'john@example.com', 'StateFarm', 'POL123', 1, 0),
(2, 'Ms', 'Jane', 'Smith', '456 Oak Ave', '222-222-2222', 'jane@example.com', 'Allianz', 'POL456', 0, 1),
(3, 'Mr', 'Mike', 'Brown', '789 Pine Rd', '333-333-3333', 'mike@example.com', 'Geico', 'POL789', 2, 2);
INSERT INTO vehicles VALUES
(1, 1, 'Toyota', 'Camry', '2020', 'ABC1234'),
(2, 2, 'Honda', 'Civic', '2019', 'XYZ5678'),
(3, 3, 'Ford', 'Focus', '2018', 'LMN9101');
INSERT INTO riders VALUES
(1, '12 King St', '444-444-4444'),
(2, '34 Queen St', '555-555-5555'),
(3, '56 Prince St', '666-666-6666');
INSERT INTO cards VALUES
(1, 1, '123456789012', 'John Doe', '12/27'),
(2, 2, '234567890123', 'Jane Smith', '11/26'),
(3, 3, '345678901234', 'Mike Brown', '10/25');
INSERT INTO rides (ride_id, pickup_location, pickup_date, pickup_time, dropoff_location, base_cost, driver_id, driver_satisfaction, card_id, rider_id) VALUES
(1, 'Downtown', '2026-03-01', '08:00:00', 'Airport', 20.00, 1, 5, 1, 1),
(2, 'Mall', '2026-03-02', '09:30:00', 'University', 15.50, 2, 4, 2, 2),
(3, 'Station', '2026-03-03', '11:00:00', 'Hotel', 30.00, 3, 3, 3, 3);
SELECT * FROM drivers;
SELECT * FROM vehicles;
SELECT * FROM riders;
SELECT * FROM cards;
SELECT * FROM rides;
SELECT * FROM drivers
INNER JOIN vehicles ON drivers.driver_id = vehicles.driver_id;
SELECT * FROM riders
INNER JOIN cards ON riders.rider_id = cards.rider_id;
SELECT * FROM rides
INNER JOIN drivers ON rides.driver_id = drivers.driver_id
INNER JOIN riders ON rides.rider_id = riders.rider_id;