Compare commits
23 Commits
4b1b63befb
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 59e0329d1e | |||
| a747e2a1d9 | |||
| 015ea75186 | |||
| ee2a792c56 | |||
| e2aa277aaf | |||
| 9daa37287f | |||
| a253f3ffb2 | |||
| 942da76704 | |||
| f3667266a9 | |||
| fd7b36e76a | |||
| 8c78e75b97 | |||
| 8b132e776f | |||
| b732795717 | |||
| 41ebd4ac62 | |||
| 1fdfbb1b4f | |||
| a7b70a2a55 | |||
| f186c94048 | |||
| ae48ceff91 | |||
| 05116ea9b9 | |||
| 71a5d36a7a | |||
| 1357b2362a | |||
| 064cff7cfc | |||
| 8b7df42d74 |
@@ -1 +1,3 @@
|
|||||||
INFO-3174 (Web Security)/kali-linux-2025.4-vmware-amd64.vmwarevm
|
INFO-3174 (Web Security)/kali-linux-2025.4-vmware-amd64.vmwarevm
|
||||||
|
*.mp4
|
||||||
|
*.mkv
|
||||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
// Create first variables, sanitized
|
||||||
|
$firstName = filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
|
||||||
|
$lastName = filter_var($_POST['lname'], FILTER_SANITIZE_STRING);
|
||||||
|
$favMovie = filter_var($_POST['favMovie'], FILTER_SANITIZE_STRING);
|
||||||
|
$favMovieSnack = filter_var($_POST['favMovieSnack'], FILTER_SANITIZE_STRING);
|
||||||
|
$seatPref = filter_var($_POST['seatPref'], FILTER_SANITIZE_STRING);
|
||||||
|
$genFeedback = filter_var($_POST['genFeedback'], FILTER_SANITIZE_STRING);
|
||||||
|
|
||||||
|
// Create full name variable and urlencode it
|
||||||
|
$fullName = $firstName . " " . $lastName;
|
||||||
|
$nameEncoded = urlencode($fullName);
|
||||||
|
|
||||||
|
// Filter for newlines
|
||||||
|
$genFeedback = nl2br($genFeedback);
|
||||||
|
|
||||||
|
// Replace the mean words
|
||||||
|
$genFeedback = str_ireplace("bad","good",$genFeedback);
|
||||||
|
$genFeedback = str_ireplace("horrible","amazing",$genFeedback);
|
||||||
|
|
||||||
|
// Create a message variable (I just like this way more)
|
||||||
|
$message = "<p>Thank you for your feedback! Below are your survey results:</p>
|
||||||
|
<p>Full Name: $fullName</p>
|
||||||
|
<p>Favourite Movie: $favMovie</p>
|
||||||
|
<p>Favourite Movie Snack: $favMovieSnack</p>
|
||||||
|
<p>Theatre Seat Row Preference: $seatPref</p>
|
||||||
|
<p>General Feedback: $genFeedback</p>
|
||||||
|
<p>Click <a href=\"lab5.php?fullName=$nameEncoded\">Here</a> to return to the survey.</p>";
|
||||||
|
|
||||||
|
// Print the message
|
||||||
|
print($message);
|
||||||
|
?>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Lab 5 Page 1</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Movie Theatre Survey</h1>
|
||||||
|
|
||||||
|
<form action="lab5-1.php" method="post">
|
||||||
|
<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="favMovie">Favourite Movie:</label>
|
||||||
|
<input type="text" name="favMovie"><br>
|
||||||
|
<label for="favMovieSnack">Favourite Movie Snack:</label>
|
||||||
|
<input type="text" name="favMovieSnack"><br>
|
||||||
|
<label for="seatPref">Theatre Seat Row Preference:</label>
|
||||||
|
<select name="seatPref">
|
||||||
|
<option value="Back">Back</option>
|
||||||
|
<option value="Middle">Middle</option>
|
||||||
|
<option value="Front">Front</option>
|
||||||
|
</select><br>
|
||||||
|
<label for="genFeedback">General Feedback:</label>
|
||||||
|
<textarea name="genFeedback"></textarea><br>
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 67 KiB |
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
// Get and print age, print error if empty
|
||||||
|
|
||||||
|
if (!isset($_POST["ageInput"]) || $_POST["ageInput"] === "") {
|
||||||
|
print("Please enter a valid age above or equal to 0<br>");
|
||||||
|
} else {
|
||||||
|
$userAge = $_POST["ageInput"];
|
||||||
|
$birthYear = date("Y") - $userAge;
|
||||||
|
if ($userAge < 0) {
|
||||||
|
print("Please enter a valid age above or equal to 0");
|
||||||
|
} else {
|
||||||
|
print("Your age is " . $userAge . "<br>");
|
||||||
|
|
||||||
|
// Two ways to determine even-ness
|
||||||
|
$isEven = ($userAge % 2 === 0) ? "Your age is even<br>" : "Your age is odd<br>";
|
||||||
|
print($isEven);
|
||||||
|
|
||||||
|
// OR
|
||||||
|
// if ($userAge % 2 === 0) {
|
||||||
|
// print("Your name is even<br>");
|
||||||
|
// } else {
|
||||||
|
// print("Your name is odd<br>");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Print age "category"
|
||||||
|
if ($userAge <= 12) {
|
||||||
|
print("You are a child<br>");
|
||||||
|
} else if ($userAge > 12 && $userAge <= 17) {
|
||||||
|
print("You are a teenager<br>");
|
||||||
|
} else if ($userAge > 17 && $userAge <= 54) {
|
||||||
|
print("You are an adult<br>");
|
||||||
|
} else {
|
||||||
|
print("You are a senior<br>");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print significant events with switch statement
|
||||||
|
switch ($birthYear) {
|
||||||
|
case 1969:
|
||||||
|
print("You were born the same year as the moon landing<br>");
|
||||||
|
break;
|
||||||
|
case 1983:
|
||||||
|
print("You were born the same year as the creation of the internet<br>");
|
||||||
|
break;
|
||||||
|
case 1986:
|
||||||
|
print("You were born the same year as the Challenger explosion<br>");
|
||||||
|
break;
|
||||||
|
case 2000:
|
||||||
|
print("You were born the same year as Y2K<br>");
|
||||||
|
break;
|
||||||
|
case 2020:
|
||||||
|
print("You were born the same year as the COVID-19 pandemic<br>");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print("You were not born in any significant year<br>");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print age number of hearts
|
||||||
|
for ($i = 0; $i < $userAge; $i++) {
|
||||||
|
print("♥");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<br>");
|
||||||
|
|
||||||
|
// Print 100 - age number of stars
|
||||||
|
for ($i = 0; $i < (100 - $userAge); $i++) {
|
||||||
|
print("☆");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<br>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>PHP Lab 6</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Age Result Generator</h1>
|
||||||
|
<form method="post">
|
||||||
|
<label for="ageInput">Please enter your age:</label>
|
||||||
|
<input name="ageInput" type="number"><br>
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 89 KiB |
@@ -0,0 +1,103 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>PHP Lab 7</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Months of the Year</h1>
|
||||||
|
<?php
|
||||||
|
$months = [
|
||||||
|
1 => "January",
|
||||||
|
"February",
|
||||||
|
"March",
|
||||||
|
"April",
|
||||||
|
"May",
|
||||||
|
"June",
|
||||||
|
"July",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"October",
|
||||||
|
"November",
|
||||||
|
"December"
|
||||||
|
];
|
||||||
|
|
||||||
|
print_r($months);
|
||||||
|
|
||||||
|
echo "<br><br>";
|
||||||
|
|
||||||
|
$months[13] = "Winter";
|
||||||
|
$months[14] = "Construction";
|
||||||
|
|
||||||
|
foreach ($months as $type => $value) {
|
||||||
|
echo "The month of $value is month number $type<br>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Pizza Toppings</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$vegetables = [
|
||||||
|
"Green Peppers",
|
||||||
|
"Mushrooms",
|
||||||
|
"Olives",
|
||||||
|
"Chives"
|
||||||
|
];
|
||||||
|
$meats = [
|
||||||
|
"Pepperoni",
|
||||||
|
"Ham",
|
||||||
|
"Bacon"
|
||||||
|
];
|
||||||
|
$cheeses = [
|
||||||
|
"Mozzarella",
|
||||||
|
"Cheddar",
|
||||||
|
"Provologne"
|
||||||
|
];
|
||||||
|
|
||||||
|
$toppings = [
|
||||||
|
"Vegetables" => $vegetables,
|
||||||
|
"Meats" => $meats,
|
||||||
|
"Cheeses" => $cheeses
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($toppings as $type => $value) {
|
||||||
|
echo "$type: ";
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $number => $topping) {
|
||||||
|
echo "$topping, ";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "$type is $value<br>";
|
||||||
|
}
|
||||||
|
echo "<br>";
|
||||||
|
};
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
|
$prices = [
|
||||||
|
"Small" => 6.99,
|
||||||
|
"Medium" => 8.99,
|
||||||
|
"Large" => 13.99,
|
||||||
|
"X-Large" => 18.99,
|
||||||
|
"Supersize" => 22.99
|
||||||
|
];
|
||||||
|
|
||||||
|
asort($prices);
|
||||||
|
|
||||||
|
foreach ($prices as $type => $value) {
|
||||||
|
echo "$type: $value<br>";
|
||||||
|
};
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
|
ksort($prices);
|
||||||
|
|
||||||
|
foreach ($prices as $type => $value) {
|
||||||
|
echo "$type: $value<br>";
|
||||||
|
};
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 85 KiB |
@@ -0,0 +1,95 @@
|
|||||||
|
body {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 20px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header Styles */
|
||||||
|
header .logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo i {
|
||||||
|
display: block;
|
||||||
|
color: teal;
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo span {
|
||||||
|
color: #666677;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo span strong {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav {
|
||||||
|
background-color: teal;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.75rem;
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a.active {
|
||||||
|
color: teal;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Styles */
|
||||||
|
main {
|
||||||
|
display: block;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
main h1 {
|
||||||
|
color: #666677;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer Styles */
|
||||||
|
footer {
|
||||||
|
display: block;
|
||||||
|
padding: 1.5rem 1rem;
|
||||||
|
background-color: teal;
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer strong {
|
||||||
|
font-weight: 600;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?php define("TITLE", "Best Pizza In The World!"); ?>
|
||||||
|
<?php include("template/header.php"); ?>
|
||||||
|
<p>This is the content of the home page.</p>
|
||||||
|
<?php include("template/footer.php"); ?>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
define("TITLE", "User Login");
|
||||||
|
include("template/header.php");
|
||||||
|
print("<h2>Login Form<h2>");
|
||||||
|
|
||||||
|
$formStart = "<form class='login' action='login.php' method='post'>";
|
||||||
|
$emailLabel = "<label for='email'>Email:</label>";
|
||||||
|
$emailInput = "<input type='email' name='email'>";
|
||||||
|
$passLabel = "<label for='pass'>Password:</label>";
|
||||||
|
$passInput = "<input type='password' name='pass'>";
|
||||||
|
$submit = "<input type='submit' name='submit' value='Log In'>";
|
||||||
|
$formEnd = "</form";
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$email = htmlspecialchars($_POST['email']);
|
||||||
|
$password = htmlspecialchars($_POST['pass']);
|
||||||
|
|
||||||
|
$stickyForm = $formStart .
|
||||||
|
$emailLabel . $emailInput .
|
||||||
|
$passLabel . $passInput .
|
||||||
|
$submit .
|
||||||
|
$formEnd;
|
||||||
|
|
||||||
|
if (!empty($email) && !empty($password)) {
|
||||||
|
if ((strtolower($email) == 'test@test.com') && ($password == 'test')) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Location: specials.php');
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
print("<p>Email or password is incorrect. Please try again.</p>" . $stickyForm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("<p>Email and password are required. Please try again.</p>" . $stickyForm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print($stickyForm = $formStart .
|
||||||
|
$emailLabel . $emailInput .
|
||||||
|
$passLabel . $passInput .
|
||||||
|
$submit .
|
||||||
|
$formEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
include("template/footer.php");
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
define("TITLE", "Today's Specials");
|
||||||
|
date_default_timezone_set("America/Toronto");
|
||||||
|
$date = date("l F j Y");
|
||||||
|
$message = "<h2>These are our specails for $date:</h2>
|
||||||
|
<p>Extra Large Meat Lovers Pizza - $17.99</p>
|
||||||
|
<p>Toppings:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Pepperoni</li>
|
||||||
|
<li>Bacon</li>
|
||||||
|
<li>Ham</li>
|
||||||
|
<li>Mozzarella Cheese</li>
|
||||||
|
</ul>";
|
||||||
|
include("template/header.php");
|
||||||
|
print($message);
|
||||||
|
include("template/footer.php");
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<!-- Footer -->
|
||||||
|
<footer class="siteFooter">
|
||||||
|
<p>
|
||||||
|
<strong>© 2025</strong>l_mclean215318's Pizza. All rights reserved.
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
date_default_timezone_set("America/Toronto");
|
||||||
|
print(date("l F j, Y"));
|
||||||
|
?>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
ob_end_flush();
|
||||||
|
?>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<!-- Header -->
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||||
|
<title><?php if (defined("TITLE")) {
|
||||||
|
print(TITLE);
|
||||||
|
} else {
|
||||||
|
print("l_mclean215318's Pizza");
|
||||||
|
} ?></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header class="siteHeader">
|
||||||
|
<section>
|
||||||
|
<h1 class="logo">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="images/logo.png" alt="Pizza logo">
|
||||||
|
l_mclean215318's Pizza
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#">Place Order</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Menu</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="specials.php">Specials</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="login.php">Register</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
</body>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||||
|
<title>l_mclean215318's Webpage</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- Header -->
|
||||||
|
<header class="siteHeader">
|
||||||
|
<section>
|
||||||
|
<h1 class="logo">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="images/logo.png" alt="Pizza logo">
|
||||||
|
l_mclean215318's Pizza
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="order.php">Place Order</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Menu</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Specials</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Register</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main class="siteContent">
|
||||||
|
<h1>Welcome</h1>
|
||||||
|
<p>This is the content of the home page.</p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="siteFooter">
|
||||||
|
<p>
|
||||||
|
<strong>© 2025</strong>l_mclean215318's Pizza. All rights reserved.
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,95 @@
|
|||||||
|
body {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 20px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header Styles */
|
||||||
|
header .logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo i {
|
||||||
|
display: block;
|
||||||
|
color: teal;
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo span {
|
||||||
|
color: #666677;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
header .logo span strong {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav {
|
||||||
|
background-color: teal;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.75rem;
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
header nav ul li a.active {
|
||||||
|
color: teal;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Styles */
|
||||||
|
main {
|
||||||
|
display: block;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
main h1 {
|
||||||
|
color: #666677;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer Styles */
|
||||||
|
footer {
|
||||||
|
display: block;
|
||||||
|
padding: 1.5rem 1rem;
|
||||||
|
background-color: teal;
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer strong {
|
||||||
|
font-weight: 600;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?php define("TITLE", "Best Pizza In The World!"); ?>
|
||||||
|
<?php include("template/header.php"); ?>
|
||||||
|
<p>This is the content of the home page.</p>
|
||||||
|
<?php include("template/footer.php"); ?>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
define("TITLE", "User Login");
|
||||||
|
include("template/header.php");
|
||||||
|
print("<h2>Login Form<h2>");
|
||||||
|
|
||||||
|
$formStart = "<form class='login' action='login.php' method='post'>";
|
||||||
|
$emailLabel = "<label for='email'>Email:</label>";
|
||||||
|
$emailInput = "<input type='email' name='email'>";
|
||||||
|
$passLabel = "<label for='pass'>Password:</label>";
|
||||||
|
$passInput = "<input type='password' name='pass'>";
|
||||||
|
$submit = "<input type='submit' name='submit' value='Log In'>";
|
||||||
|
$formEnd = "</form";
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$email = htmlspecialchars($_POST['email']);
|
||||||
|
$password = htmlspecialchars($_POST['pass']);
|
||||||
|
|
||||||
|
$stickyForm = $formStart .
|
||||||
|
$emailLabel . $emailInput .
|
||||||
|
$passLabel . $passInput .
|
||||||
|
$submit .
|
||||||
|
$formEnd;
|
||||||
|
|
||||||
|
if (!empty($email) && !empty($password)) {
|
||||||
|
if ((strtolower($email) == 'test@test.com') && ($password == 'test')) {
|
||||||
|
session_start();
|
||||||
|
$_SESSION['email'] = $_POST['email'];
|
||||||
|
$_SESSION['loggedin'] = time();
|
||||||
|
ob_end_clean();
|
||||||
|
header('Location: menu.php');
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
print("<p>Email or password is incorrect. Please try again.</p>" . $stickyForm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("<p>Email and password are required. Please try again.</p>" . $stickyForm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print($stickyForm = $formStart .
|
||||||
|
$emailLabel . $emailInput .
|
||||||
|
$passLabel . $passInput .
|
||||||
|
$submit .
|
||||||
|
$formEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
include("template/footer.php");
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
define("TITLE", "Pizza Site Logout");
|
||||||
|
include("template/header.php");
|
||||||
|
?>
|
||||||
|
<p>You have logged out. <a href="index.php">Click here to log in again</a>.</p>
|
||||||
|
|
||||||
|
<?php include("template/footer.php"); ?>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php define("TITLE", "The Best Pizza Menu in The World"); ?>
|
||||||
|
<?php session_start(); ?>
|
||||||
|
<?php include("template/header.php"); ?>
|
||||||
|
<?php date_default_timezone_set("America/Toronto"); ?>
|
||||||
|
<?php
|
||||||
|
echo "Hello, " . $_SESSION['email'];
|
||||||
|
echo "<br>";
|
||||||
|
echo "You logged in at: " . date("l F j, Y, g:i A", $_SESSION['loggedin']);
|
||||||
|
echo "<br>";
|
||||||
|
?>
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
<?php include("template/footer.php"); ?>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
define("TITLE", "Today's Specials");
|
||||||
|
date_default_timezone_set("America/Toronto");
|
||||||
|
$date = date("l F j Y");
|
||||||
|
$message = "<h2>These are our specails for $date:</h2>
|
||||||
|
<p>Extra Large Meat Lovers Pizza - $17.99</p>
|
||||||
|
<p>Toppings:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Pepperoni</li>
|
||||||
|
<li>Bacon</li>
|
||||||
|
<li>Ham</li>
|
||||||
|
<li>Mozzarella Cheese</li>
|
||||||
|
</ul>";
|
||||||
|
include("template/header.php");
|
||||||
|
print($message);
|
||||||
|
include("template/footer.php");
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<!-- Footer -->
|
||||||
|
<footer class="siteFooter">
|
||||||
|
<p>
|
||||||
|
<strong>© 2025</strong>l_mclean215318's Pizza. All rights reserved.
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
date_default_timezone_set("America/Toronto");
|
||||||
|
print(date("l F j, Y"));
|
||||||
|
?>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
ob_end_flush();
|
||||||
|
?>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<!-- Header -->
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||||
|
<title><?php if (defined("TITLE")) {
|
||||||
|
print(TITLE);
|
||||||
|
} else {
|
||||||
|
print("l_mclean215318's Pizza");
|
||||||
|
} ?></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header class="siteHeader">
|
||||||
|
<section>
|
||||||
|
<h1 class="logo">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="images/logo.png" alt="Pizza logo">
|
||||||
|
l_mclean215318's Pizza
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#">Place Order</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="menu.php">Menu</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="specials.php">Specials</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="login.php">Register</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
</body>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||||
|
<title>l_mclean215318's Webpage</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- Header -->
|
||||||
|
<header class="siteHeader">
|
||||||
|
<section>
|
||||||
|
<h1 class="logo">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="images/logo.png" alt="Pizza logo">
|
||||||
|
l_mclean215318's Pizza
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="order.php">Place Order</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Menu</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Specials</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Register</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main class="siteContent">
|
||||||
|
<h1>Welcome</h1>
|
||||||
|
<p>This is the content of the home page.</p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="siteFooter">
|
||||||
|
<p>
|
||||||
|
<strong>© 2025</strong>l_mclean215318's Pizza. All rights reserved.
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
if (isset($_POST['font_size']) && isset($_POST['font_color'])) {
|
||||||
|
setcookie('fontsize', $_POST['font_size']);
|
||||||
|
setcookie('fontcolor', $_POST['font_color']);
|
||||||
|
$message = "Your settings have beens set!";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Customize Your Settings</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
if (isset($message)) {
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<p>Use this form to customize your settings:</p>
|
||||||
|
<form action="customize.php" method="post">
|
||||||
|
<select name="font_size">
|
||||||
|
<option selected value="">Font Size</option>
|
||||||
|
<option value="xl">Extra Large</option>
|
||||||
|
<option value="l">Large</option>
|
||||||
|
<option value="m">Medium</option>
|
||||||
|
<option value="s">Small</option>
|
||||||
|
<option value="xs">Extra Small</option>
|
||||||
|
</select>
|
||||||
|
<select name="font_color">
|
||||||
|
<option selected value="">Font Color</option>
|
||||||
|
<option value="black">Black</option>
|
||||||
|
<option value="red">Red</option>
|
||||||
|
<option value="blue">Blue</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" name="submit" value="Set my preferences">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<!-- Below is a header -->
|
||||||
|
<h1>This is a header!</h1>
|
||||||
|
|
||||||
|
<!-- Below is a header.
|
||||||
|
It is a very important header. -->
|
||||||
|
<h1> This is still a header! </h1>
|
||||||
|
|
||||||
|
<form action="submit.php" method="post">
|
||||||
|
<!-- Text input -->
|
||||||
|
<label>Text</label>
|
||||||
|
<input type="text" name="desc">
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Textarea -->
|
||||||
|
<label>Textarea</label>
|
||||||
|
<textarea name="desc-2"></textarea>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Select -->
|
||||||
|
<label>Select</label>
|
||||||
|
<select name="food">
|
||||||
|
<option value="burger">Burger</option>
|
||||||
|
<option value="pizza">Pizza</option>
|
||||||
|
<option value="pie">Pie</option>
|
||||||
|
</select>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Checkbox -->
|
||||||
|
<label>Checkbox</label>
|
||||||
|
<input type="checkbox" value="purple">
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Radio button -->
|
||||||
|
<label>Radio</label>
|
||||||
|
<input type="radio" value="yes">
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Button -->
|
||||||
|
<button type="button" onclick="alert('Hello')">Alert</button>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<!-- Example -->
|
||||||
|
<label>Grade</label>
|
||||||
|
<input type="text" name="grade">
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
# PHP comment with hashtag.
|
||||||
|
// PHP comment with two slashes.
|
||||||
|
/*
|
||||||
|
Multi-line
|
||||||
|
PHP comment
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// empty().
|
||||||
|
// isset().
|
||||||
|
// is_numeric().
|
||||||
|
if (
|
||||||
|
!empty($_POST['grade']) &&
|
||||||
|
isset($_POST['grade']) &&
|
||||||
|
is_numeric($_POST['grade'])
|
||||||
|
) {
|
||||||
|
$grade = $_POST['grade'];
|
||||||
|
print_r($grade);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo 'Grade not provided and/or was not numeric!';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strip Tags.
|
||||||
|
$text = 'Hello <b><em>world!</em></b>';
|
||||||
|
echo $text;
|
||||||
|
echo strip_tags($text);
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// All of the following will give the same result.
|
||||||
|
echo 123 + 1;
|
||||||
|
echo '<br>';
|
||||||
|
echo "123" + 1;
|
||||||
|
echo '<br>';
|
||||||
|
echo "123" + "1";
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Arithmetic operators.
|
||||||
|
echo '<strong>Arithmetic operators</strong><br>';
|
||||||
|
echo 'Addition (+) ' . 1 + 2 . '<br>';
|
||||||
|
echo 'Subtraction (-) ' . 2 - 1 . '<br>';
|
||||||
|
echo 'Multiplication (*) ' . 2 * 2 . '<br>';
|
||||||
|
echo 'Division (/) ' . 4 / 2 . '<br>';
|
||||||
|
echo 'Modulus (%) ' . 4 % 2 . '<br>';
|
||||||
|
$a = 1;
|
||||||
|
$a++;
|
||||||
|
echo 'Increment (++) ' . $a . '<br>';
|
||||||
|
$a--;
|
||||||
|
echo 'Decrement (--) ' . $a . '<br>';
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
// Assignment operators.
|
||||||
|
echo '<strong>Assignment operators</strong><br>';
|
||||||
|
$a = 2;
|
||||||
|
echo $a . '<br>';
|
||||||
|
$a += 2;
|
||||||
|
echo $a . '<br>';
|
||||||
|
$a -= 2;
|
||||||
|
echo $a . '<br>';
|
||||||
|
$a *= 2;
|
||||||
|
echo $a . '<br>';
|
||||||
|
$a /= 2;
|
||||||
|
echo $a . '<br>';
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
// Comparison operators.
|
||||||
|
echo '<strong>Comparison operators</strong><br>';
|
||||||
|
$a = 1;
|
||||||
|
$b = 2;
|
||||||
|
$c = '2';
|
||||||
|
|
||||||
|
echo ($a < $b) . '<br>';
|
||||||
|
echo ($a > $b) . '<br>';
|
||||||
|
echo ($a == $b) . '<br>';
|
||||||
|
echo ($a != $b) . '<br>';
|
||||||
|
echo ($b == $c) . '<br>';
|
||||||
|
echo ($b === $c) . '<br>';
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
// Formatting numbers.
|
||||||
|
echo '<strong>Formatting numbers</strong><br>';
|
||||||
|
|
||||||
|
echo 'Round (2.49): ' . round(2.49) . '<br>';
|
||||||
|
echo 'Number Format (21233122):' . number_format(21233122) . '<br>';
|
||||||
|
echo 'Printf: ';
|
||||||
|
$sub = 5;
|
||||||
|
$tax = 0.65;
|
||||||
|
printf('The subtotal is %u, making the tax
|
||||||
|
%.2f.', $sub, $tax);
|
||||||
|
echo '<br>';
|
||||||
|
echo 'Mt Rand: ' . mt_rand(0, 100);
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* String Concatenation. */
|
||||||
|
|
||||||
|
// Using the dot (.) operator
|
||||||
|
$string1 = 'Hello';
|
||||||
|
$string2 = 'World';
|
||||||
|
$concatenation = $string1 . $string2;
|
||||||
|
echo $concatenation;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Using the concatenation assignment operator (.=)
|
||||||
|
$string1 = 'Hello';
|
||||||
|
$string2 = 'World';
|
||||||
|
$string1 .= ' ' . $string2;
|
||||||
|
echo $string1;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Using double quotes (") to directly concatenate variables within a string
|
||||||
|
$string1 = 'Hello';
|
||||||
|
$string2 = 'World';
|
||||||
|
$concatenation = "$string1 $string2";
|
||||||
|
echo $concatenation;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Newlines */
|
||||||
|
|
||||||
|
// Using the "\n" escape sequence
|
||||||
|
echo "Line 1\nLine 2\nLine 3";
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Using double quotes (")
|
||||||
|
echo "Line 1
|
||||||
|
Line 2
|
||||||
|
Line 3";
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Using PHP_EOL constant, which represents the correct end-of-line character
|
||||||
|
echo "Line 1" . PHP_EOL . "Line 2" . PHP_EOL . "Line 3";
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Using the nl2br() function to insert HTML line breaks (\n) before all newlines in a string
|
||||||
|
$text = "Line 1\nLine 2\nLine 3";
|
||||||
|
echo nl2br($text);
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Handling HTML String Input */
|
||||||
|
|
||||||
|
// htmlspecialchars()
|
||||||
|
$string = "<a href='test'>Test & 'Example'</a>";
|
||||||
|
$safe_string = htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||||
|
echo $safe_string;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// htmlentities()
|
||||||
|
$string = "<a href='test'>Test & 'Example'</a>";
|
||||||
|
$safe_string = htmlentities($string, ENT_QUOTES, 'UTF-8');
|
||||||
|
echo $safe_string;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Encoding and Decoding */
|
||||||
|
|
||||||
|
// Encode
|
||||||
|
$url = urlencode("https://fanshawec.ca?programs=iwd&cpa");
|
||||||
|
echo $url;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Decode
|
||||||
|
$url = urldecode("https%3A%2F%2Ffanshawec.ca%3Fprograms%3Diwd%26cpa");
|
||||||
|
echo $url;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Adjusting strings */
|
||||||
|
|
||||||
|
// substr()
|
||||||
|
$string = "You are a wizard, Harry.";
|
||||||
|
$substr = substr($string, 9, 6);
|
||||||
|
echo $substr;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// strtok()
|
||||||
|
$string = "Luke, I am your father.";
|
||||||
|
$substr = strtok($string, ",");
|
||||||
|
echo $substr;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// strlen()
|
||||||
|
$string = "May the odds be ever in your favour.";
|
||||||
|
$length = strlen($string);
|
||||||
|
echo $length;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// Uppercase / Lowercase
|
||||||
|
$string = "hello world";
|
||||||
|
echo ucfirst($string);
|
||||||
|
echo '<br><br>';
|
||||||
|
echo ucwords($string);
|
||||||
|
echo '<br><br>';
|
||||||
|
echo strtoupper($string);
|
||||||
|
echo '<br><br>';
|
||||||
|
echo strtolower('HELLO WORLD');
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Replacing Strings */
|
||||||
|
|
||||||
|
// str_replace()
|
||||||
|
$search = 'world';
|
||||||
|
$replace = 'everyone';
|
||||||
|
$subject = 'Hello world!';
|
||||||
|
echo str_replace($search, $replace, $subject);
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// str_ireplace()
|
||||||
|
$search = 'WORLD';
|
||||||
|
$replace = 'everyone';
|
||||||
|
$subject = 'Hello world!';
|
||||||
|
echo str_ireplace($search, $replace, $subject);
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// trim()
|
||||||
|
$string = " hello world ";
|
||||||
|
echo trim($string);
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
// rtrim()
|
||||||
|
$string = "hello world!!!";
|
||||||
|
echo rtrim($string, '!');
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
$string = " hello world";
|
||||||
|
echo ltrim($string);
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// IF statement
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
if ($condition) {
|
||||||
|
// code.
|
||||||
|
}
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
if ($year === 2024) {
|
||||||
|
$isOlympicYear = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bonus: IF statements with a lot of conditions
|
||||||
|
if (
|
||||||
|
$condition_1 &&
|
||||||
|
(
|
||||||
|
$condition_2 ||
|
||||||
|
$condition_3
|
||||||
|
) &&
|
||||||
|
$condition_4
|
||||||
|
) {
|
||||||
|
// code.
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// IF/ELSE statement
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
if ($condition) {
|
||||||
|
// code.
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// other code.
|
||||||
|
}
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
if ($year === 2024) {
|
||||||
|
$isOlympicYear = TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$isOlympicYear = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternatively, you could write the above like this.
|
||||||
|
$isOlympicYear = FALSE;
|
||||||
|
if ($year === 2024) {
|
||||||
|
$isOlympicYear = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// ELSEIF statements.
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
if ($condition_1) {
|
||||||
|
// code.
|
||||||
|
}
|
||||||
|
elseif ($condition_2) {
|
||||||
|
// other code.
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// other other code.
|
||||||
|
}
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
if ($year === 2024) {
|
||||||
|
$isOlympicYear = TRUE;
|
||||||
|
}
|
||||||
|
elseif ($year === 2025) {
|
||||||
|
$isOlympicYear = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Nesting statements
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
if ($year === 2024) {
|
||||||
|
$isOlympicYear = TRUE;
|
||||||
|
|
||||||
|
if ($city === 'Paris') {
|
||||||
|
echo "Bonjour!";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "Hello!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Early Return statements
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
function checkAge($age) {
|
||||||
|
// Early return if age is less than 18
|
||||||
|
if ($age < 18) {
|
||||||
|
return "Too young";
|
||||||
|
}
|
||||||
|
// Continue with the function if age is 18+
|
||||||
|
return "Welcome!";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo checkAge(16); // Outputs: Too young
|
||||||
|
echo checkAge(20); // Outputs: Welcome!
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Ternary Expressions
|
||||||
|
// - Only good for replacing non-complex IF/ELSE statements
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
$age = 20;
|
||||||
|
$can_vote = ($age >= 18) ? 'Yes' : 'No'
|
||||||
|
|
||||||
|
// Alternatively, you could write the above like this, but the above saves lines of code.
|
||||||
|
if ($age >= 18) {
|
||||||
|
$can_vote = 'Yes';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$can_vote = 'No';
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Switch statements
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
switch ($isOlympicYear) {
|
||||||
|
case 2023:
|
||||||
|
break; // Without a break, the code will continue executing to the next case.
|
||||||
|
|
||||||
|
case 2024:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2025:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // Default is the equivalent to an ELSE
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using a switch like above instead of the following
|
||||||
|
if ($year === 2023) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
elseif ($year === 2024) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
elseif ($year === 2025) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// For loops
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
for ($i = 1; $i < 5; $i++) {
|
||||||
|
echo "This is the $i -th iteration.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// While loops
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
// E.g.
|
||||||
|
$i = 1;
|
||||||
|
while ($i < 5) {
|
||||||
|
echo "This is the $i -th iteration.";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Passing Arguments by Reference
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
function add_five(&$value) {
|
||||||
|
$value += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = 2;
|
||||||
|
add_five($num);
|
||||||
|
echo $num; // Outputs: 7
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// Using the ... operator
|
||||||
|
// - Allows for any number of arguments
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
function sum(...$numbers) {
|
||||||
|
$sum = 0;
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($numbers); $i++) {
|
||||||
|
$sum += $numbers[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo sum(1, 2, 3, 4); // Output: 10
|
||||||
|
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
|
||||||
|
$months = array(
|
||||||
|
'January', // Index = 0
|
||||||
|
'February', // Index = 1
|
||||||
|
'March', // Index = 2
|
||||||
|
);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($months);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
// Getting value from index
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($months[1]);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
// Short hand
|
||||||
|
$months = [
|
||||||
|
'January', // Index = 0
|
||||||
|
'February', // Index = 1
|
||||||
|
'March', // Index = 2
|
||||||
|
];
|
||||||
|
|
||||||
|
/* Associative Arrays */
|
||||||
|
|
||||||
|
$months = [
|
||||||
|
'month1' => 'January',
|
||||||
|
'month2' => 'February',
|
||||||
|
'month3' => 'March'
|
||||||
|
];
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($months);
|
||||||
|
echo '</pre>';
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($months['month1']);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
/* Working with Arrays */
|
||||||
|
|
||||||
|
// range()
|
||||||
|
$numbers = range(1, 10); // Same as $numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($numbers);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
$numbers = range(1, 10, 2); // Same as $numbers = [1, 3, 5, 7, 9];
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($numbers);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
// Adding to arrays
|
||||||
|
$months = [
|
||||||
|
'January', // Index = 0
|
||||||
|
'February', // Index = 1
|
||||||
|
'March', // Index = 2
|
||||||
|
];
|
||||||
|
// Add to index 3
|
||||||
|
$months[3] = 'April';
|
||||||
|
// Change index 2
|
||||||
|
$months[2] = 'May';
|
||||||
|
// Add to end of array
|
||||||
|
$months[] = 'June';
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($months);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
/* Merging Arrays */
|
||||||
|
$sem1grades = [
|
||||||
|
'math' => 90,
|
||||||
|
'chemistry' => 67,
|
||||||
|
'biology' => 88,
|
||||||
|
'history' => 45,
|
||||||
|
'gym' => 60,
|
||||||
|
];
|
||||||
|
$sem2grades = [
|
||||||
|
'philosophy' => 87,
|
||||||
|
'art' => 99,
|
||||||
|
'physics' => 71,
|
||||||
|
'gym' => 60,
|
||||||
|
];
|
||||||
|
|
||||||
|
// array_merge()
|
||||||
|
$allGrades = array_merge($sem1grades, $sem2grades);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($allGrades);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
// Array Union
|
||||||
|
$allGrades = $sem1grades + $sem2grades;
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($allGrades);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
/* Multidimensional arrays */
|
||||||
|
$meats = [
|
||||||
|
'Pepperoni',
|
||||||
|
'Bacon',
|
||||||
|
'Ham',
|
||||||
|
];
|
||||||
|
$cheeses = [
|
||||||
|
'Mozzarella',
|
||||||
|
'Cheddar',
|
||||||
|
'Swiss',
|
||||||
|
];
|
||||||
|
$veggies = [
|
||||||
|
'Onions',
|
||||||
|
'Peppers',
|
||||||
|
'Mushrooms',
|
||||||
|
];
|
||||||
|
$toppings = [
|
||||||
|
'Meats' => $meats,
|
||||||
|
'Cheeses' => $cheeses,
|
||||||
|
'Veggies' => $veggies,
|
||||||
|
'Size' => 'Medium',
|
||||||
|
];
|
||||||
|
echo $toppings['Veggies'][1];
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Printing Arrays */
|
||||||
|
|
||||||
|
// foreach()
|
||||||
|
foreach ($toppings as $type => $value) {
|
||||||
|
echo "{$type}:</br>";
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $number => $topping) {
|
||||||
|
echo "Topping #{$number} is $topping</br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "{$type} is $value</br>";
|
||||||
|
}
|
||||||
|
echo "</br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$words = [
|
||||||
|
'The',
|
||||||
|
'cow',
|
||||||
|
'jumped',
|
||||||
|
'over',
|
||||||
|
'the',
|
||||||
|
'moon',
|
||||||
|
];
|
||||||
|
// implode()
|
||||||
|
$sentence = implode(' ', $words);
|
||||||
|
echo $sentence;
|
||||||
|
echo '<br><br>';
|
||||||
|
// explode()
|
||||||
|
$words2 = explode(' ', $sentence);
|
||||||
|
echo $words2;
|
||||||
|
echo '<br><br>';
|
||||||
|
|
||||||
|
/* Sorting Arrays */
|
||||||
|
|
||||||
|
$array1 = [
|
||||||
|
3,
|
||||||
|
1,
|
||||||
|
4,
|
||||||
|
1,
|
||||||
|
5,
|
||||||
|
9,
|
||||||
|
];
|
||||||
|
// sort()
|
||||||
|
sort($array1);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($array1);
|
||||||
|
echo '</pre>';
|
||||||
|
// rsort()
|
||||||
|
rsort($array1);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($array1);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
$assocArray = [
|
||||||
|
'a' => 3,
|
||||||
|
'b' => 1,
|
||||||
|
'c' => 4,
|
||||||
|
];
|
||||||
|
// asort()
|
||||||
|
asort($assocArray);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($assocArray);
|
||||||
|
echo '</pre>';
|
||||||
|
$assocArray = [
|
||||||
|
'a' => 3,
|
||||||
|
'b' => 1,
|
||||||
|
'c' => 4,
|
||||||
|
];
|
||||||
|
// ksort()
|
||||||
|
ksort($assocArray);
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($assocArray);
|
||||||
|
echo '</pre>';
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
USE mynorthwind;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS invoices (
|
||||||
|
invoiceId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
customer VARCHAR(5) NOT NULL,
|
||||||
|
amount INT NOT NULL,
|
||||||
|
date DATE NOT NULL,
|
||||||
|
FOREIGN KEY (customer) REFERENCES customers(CustomerID)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ANATR', 250, '2026-01-06');
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ANTON', 375, '2026-01-02');
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ALFKI', 125, '2026-01-25');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS returns (
|
||||||
|
returnId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
customer VARCHAR(5) NOT NULL,
|
||||||
|
amount INT NOT NULL,
|
||||||
|
date DATE NOT NULL,
|
||||||
|
FOREIGN KEY (customer) REFERENCES customers(CustomerID)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ANATR', 111, '2026-02-12');
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ANTON', 950, '2026-02-26');
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ALFKI', 10205, '2026-03-01');
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
Customers
|
||||||
|
ID
|
||||||
|
First name
|
||||||
|
Last name
|
||||||
|
Street Address
|
||||||
|
City
|
||||||
|
Province/State
|
||||||
|
Postal Code
|
||||||
|
Phone Number
|
||||||
|
Email Address
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Tracks who the client is and how to contact them.
|
||||||
|
|
||||||
|
Relationship:
|
||||||
|
One customer can have multiple contracts.
|
||||||
|
|
||||||
|
Contracts
|
||||||
|
Contract ID (unique identifier)
|
||||||
|
Customer ID (links to the customer)
|
||||||
|
Building Street Address
|
||||||
|
City
|
||||||
|
Province/State
|
||||||
|
Postal Code
|
||||||
|
Scheduled Date
|
||||||
|
Scheduled Time
|
||||||
|
Employee ID (employee assigned to the job)
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Tracks each job being performed.
|
||||||
|
|
||||||
|
Relationships:
|
||||||
|
Each contract belongs to one customer.
|
||||||
|
Each contract is handled by one employee.
|
||||||
|
Each contract can contain multiple rooms.
|
||||||
|
|
||||||
|
Rooms
|
||||||
|
Room ID
|
||||||
|
Contract ID
|
||||||
|
Room Name
|
||||||
|
Paint ID
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Tracks individual areas being painted for each contract.
|
||||||
|
|
||||||
|
Relationships:
|
||||||
|
Each room belongs to one contract.
|
||||||
|
Each room uses one paint color.
|
||||||
|
|
||||||
|
Inventory
|
||||||
|
Paint ID
|
||||||
|
Paint Name
|
||||||
|
Cost Per Can
|
||||||
|
Quantity
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Tracks paint options and pricing so customers know how much each paint can costs.
|
||||||
|
|
||||||
|
Relationships:
|
||||||
|
One paint type can be used in many rooms.
|
||||||
|
|
||||||
|
Employees
|
||||||
|
Employee ID
|
||||||
|
First Name
|
||||||
|
Last Name
|
||||||
|
Address
|
||||||
|
Postal Code
|
||||||
|
Hire Date
|
||||||
|
Salary
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Tracks the staff doing the work.
|
||||||
|
|
||||||
|
Relationship:
|
||||||
|
One employee can be assigned to multiple contracts.
|
||||||
|
Each contract has exactly one employee.
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS `paintingbusiness` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
|
||||||
|
USE `paintingbusiness`;
|
||||||
|
-- MySQL dump 10.13 Distrib 8.0.45, for Win64 (x86_64)
|
||||||
|
--
|
||||||
|
-- Host: 127.0.0.1 Database: paintingbusiness
|
||||||
|
-- ------------------------------------------------------
|
||||||
|
-- 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 `contracts`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `contracts`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `contracts` (
|
||||||
|
`contract_id` int(11) NOT NULL,
|
||||||
|
`customer_id` int(11) NOT NULL,
|
||||||
|
`employee_id` int(11) NOT NULL,
|
||||||
|
`address` varchar(255) NOT NULL,
|
||||||
|
`scheduled_for` datetime NOT NULL,
|
||||||
|
PRIMARY KEY (`contract_id`),
|
||||||
|
KEY `customer_id` (`customer_id`),
|
||||||
|
KEY `employee_id` (`employee_id`),
|
||||||
|
CONSTRAINT `contracts_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`),
|
||||||
|
CONSTRAINT `contracts_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `contracts`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `contracts` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `contracts` DISABLE KEYS */;
|
||||||
|
INSERT INTO `contracts` VALUES (1,1,2,'123 Maple St','2026-04-10 10:00:00'),(2,2,1,'45 Oak Ave','2026-04-12 09:00:00'),(3,3,3,'78 Pine Rd','2026-04-15 13:30:00');
|
||||||
|
/*!40000 ALTER TABLE `contracts` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `customers`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `customers`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `customers` (
|
||||||
|
`customer_id` int(11) NOT NULL,
|
||||||
|
`first_name` varchar(25) NOT NULL,
|
||||||
|
`last_name` varchar(30) NOT NULL,
|
||||||
|
`address` varchar(255) NOT NULL,
|
||||||
|
`phone` varchar(15) NOT NULL,
|
||||||
|
`email` varchar(30) NOT NULL,
|
||||||
|
PRIMARY KEY (`customer_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `customers`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `customers` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `customers` DISABLE KEYS */;
|
||||||
|
INSERT INTO `customers` VALUES (1,'John','Smith','123 Maple St','416-555-1111','john.smith@email.com'),(2,'Sarah','Johnson','45 Oak Ave','416-555-2222','sarah.j@email.com'),(3,'Michael','Brown','78 Pine Rd','416-555-3333','m.brown@email.com');
|
||||||
|
/*!40000 ALTER TABLE `customers` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `employees`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `employees`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `employees` (
|
||||||
|
`employee_id` int(11) NOT NULL,
|
||||||
|
`first_name` varchar(25) NOT NULL,
|
||||||
|
`last_name` varchar(30) NOT NULL,
|
||||||
|
`address` varchar(255) NOT NULL,
|
||||||
|
`hire_date` datetime NOT NULL,
|
||||||
|
`salary` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`employee_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `employees`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `employees` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `employees` DISABLE KEYS */;
|
||||||
|
INSERT INTO `employees` VALUES (1,'David','Wilson','22 Birch Ln','2022-04-12 09:00:00',45000),(2,'Emily','Davis','91 Cedar Dr','2023-01-20 09:00:00',42000),(3,'Robert','Taylor','15 Spruce Ct','2021-07-15 09:00:00',48000);
|
||||||
|
/*!40000 ALTER TABLE `employees` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `inventory`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `inventory`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `inventory` (
|
||||||
|
`paint_id` int(11) NOT NULL,
|
||||||
|
`paint_name` varchar(30) NOT NULL,
|
||||||
|
`cost_per_can` decimal(2,0) NOT NULL,
|
||||||
|
`quantity` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`paint_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `inventory`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `inventory` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `inventory` DISABLE KEYS */;
|
||||||
|
INSERT INTO `inventory` VALUES (1,'Arctic White',30,50),(2,'Ocean Blue',35,40),(3,'Sunset Yellow',28,60);
|
||||||
|
/*!40000 ALTER TABLE `inventory` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `rooms`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `rooms`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `rooms` (
|
||||||
|
`room_id` int(11) NOT NULL,
|
||||||
|
`contract_id` int(11) NOT NULL,
|
||||||
|
`paint_id` int(11) NOT NULL,
|
||||||
|
`room_name` varchar(30) NOT NULL,
|
||||||
|
PRIMARY KEY (`room_id`),
|
||||||
|
KEY `contract_id` (`contract_id`),
|
||||||
|
KEY `paint_id` (`paint_id`),
|
||||||
|
CONSTRAINT `rooms_ibfk_1` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`contract_id`),
|
||||||
|
CONSTRAINT `rooms_ibfk_2` FOREIGN KEY (`paint_id`) REFERENCES `inventory` (`paint_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `rooms`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `rooms` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `rooms` DISABLE KEYS */;
|
||||||
|
INSERT INTO `rooms` VALUES (1,1,1,'Living Room'),(2,2,2,'Bedroom'),(3,3,3,'Kitchen');
|
||||||
|
/*!40000 ALTER TABLE `rooms` 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-03-14 20:50:41
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS paintingBusiness;
|
||||||
|
USE paintingBusiness;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS customers(
|
||||||
|
customer_id INT NOT NULL PRIMARY KEY,
|
||||||
|
first_name VARCHAR(25) NOT NULL,
|
||||||
|
last_name VARCHAR(30) NOT NULL,
|
||||||
|
`address` VARCHAR(255) NOT NULL,
|
||||||
|
phone VARCHAR(15) NOT NULL,
|
||||||
|
email VARCHAR(30) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS employees(
|
||||||
|
employee_id INT NOT NULL PRIMARY KEY,
|
||||||
|
first_name VARCHAR(25) NOT NULL,
|
||||||
|
last_name VARCHAR(30) NOT NULL,
|
||||||
|
`address` VARCHAR(255) NOT NULL,
|
||||||
|
hire_date DATETIME NOT NULL,
|
||||||
|
salary INT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS inventory(
|
||||||
|
paint_id INT NOT NULL PRIMARY KEY,
|
||||||
|
paint_name VARCHAR(30) NOT NULL,
|
||||||
|
cost_per_can DECIMAL(5,2) NOT NULL,
|
||||||
|
quantity INT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS contracts(
|
||||||
|
contract_id INT NOT NULL PRIMARY KEY,
|
||||||
|
customer_id INT NOT NULL,
|
||||||
|
employee_id INT NOT NULL,
|
||||||
|
`address` VARCHAR(255) NOT NULL,
|
||||||
|
scheduled_for DATETIME NOT NULL,
|
||||||
|
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
|
||||||
|
FOREIGN KEY (employee_id) REFERENCES employees(employee_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS rooms(
|
||||||
|
room_id INT NOT NULL PRIMARY KEY,
|
||||||
|
contract_id INT NOT NULL,
|
||||||
|
paint_id INT NOT NULL,
|
||||||
|
room_name VARCHAR(30) NOT NULL,
|
||||||
|
FOREIGN KEY (contract_id) REFERENCES contracts(contract_id),
|
||||||
|
FOREIGN KEY (paint_id) REFERENCES inventory(paint_id)
|
||||||
|
);
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 564 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 504 KiB |
|
After Width: | Height: | Size: 505 KiB |
|
After Width: | Height: | Size: 260 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 434 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 93 KiB |
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
# BEGIN WordPress
|
||||||
|
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
|
||||||
|
# dynamically generated, and should only be modified via WordPress filters.
|
||||||
|
# Any changes to the directives between these markers will be overwritten.
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
RewriteBase /project/
|
||||||
|
RewriteRule ^index\.php$ - [L]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule . /project/index.php [L]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# END WordPress
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Front to the WordPress application. This file doesn't do anything, but loads
|
||||||
|
* wp-blog-header.php which does and tells WordPress to load the theme.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells WordPress to load the WordPress theme and output it.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
define( 'WP_USE_THEMES', true );
|
||||||
|
|
||||||
|
/** Loads the WordPress Environment and Template */
|
||||||
|
require __DIR__ . '/wp-blog-header.php';
|
||||||
@@ -0,0 +1,384 @@
|
|||||||
|
WordPress - Web publishing software
|
||||||
|
|
||||||
|
Copyright 2011-2025 by the contributors
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
This program incorporates work covered by the following copyright and
|
||||||
|
permission notices:
|
||||||
|
|
||||||
|
b2 is (c) 2001, 2002 Michel Valdrighi - Cafelog
|
||||||
|
|
||||||
|
Wherever third party code has been used, credit has been given in the code's
|
||||||
|
comments.
|
||||||
|
|
||||||
|
b2 is released under the GPL
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
WordPress - Web publishing software
|
||||||
|
|
||||||
|
Copyright 2003-2010 by the contributors
|
||||||
|
|
||||||
|
WordPress is released under the GPL
|
||||||
|
|
||||||
|
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
||||||
|
WRITTEN OFFER
|
||||||
|
|
||||||
|
The source code for any program binaries or compressed scripts that are
|
||||||
|
included with WordPress can be freely obtained at the following URL:
|
||||||
|
|
||||||
|
https://wordpress.org/download/source/
|
||||||