Home
Login
My Account
Catalogue
About Me
Coaching
Design
Hobbies

Welcome to my Sebsite (Seb's Website)

Welcome to my website, here you will find some of my works, as well as some information about me! Follow the links in the sidebar to the left access various parts of the site.

This website was created for CS207, given by Prof. Lin Jensen and Bishop's University. It is meant to demonstrate some of my experiments with SQL, HTML, CSS, and PHP. It is intended to serve as a mockup for a potential charity project of mine, in which I match the donations made to various charities I support with LEGO instructions and other digital media as a way to reward philantropy.

The following are descriptions of each of the major pages, their functionality, and how they work.

Login.html:
Login.html features a form with a single field that accepts emails. Submitting the form will pass its information to login_cookie.php. This program will check if the email received matches any of the emails currently in the database. If it doesn't find a match, it will insert a new email into the customers table, alongside a placeholder username, balance, and donation sum. It will then send your device a cookie, containing the email you entered on the previous form. This cookie lasts for one day, and is used on some of the pages to fetch information from the database. You will then be redirected to my_account.php.

My_account.php:
My_accout.php is a page that displays information from a given account, and allow you to modify some of the information therein. When you first open the page, it will check if you have an email cookie stored on your device. If one is not detected, you will be redirected to login.html. Otherwise, it will use that email to fetch and display data from the customers table in the database as well as a few prompts to confirm if various features are working. Below this display are a pair of forms. The first takes characters. When submitted this form calls name_change.php, which will simply overwrite whatever name was associated with your email. Below that is a simple form to add funds to your account. This one calls add_funds.php, which checks if your balance is below a certain limit (1000$), and increments your balance by however much you specified. After that is the model display section.
This one is a doozie.
The model display starts by checking the model_email table in the database to find how many products are currently associated with your account. It will then begin a for loop that repeats based on the number of products discovered. Each itteration will select a page number associated with your email, and use that page number to select the associated image url and description crom the models table. This array is then split into two seperate variables, with single quotes appended on either side. These variables are then inserted into an echo statement which generates an image display using the information.

Catalogue.php:
Catalogue.php, as the name suggests, serves as a catalogue of all the items the user can "purchase". Although it appears to be multiple pages, it is actually a singe page that changes dynamically using a cookie that saves the user's place in the catalogue. When you first open the page, it will check if you have an email cookie stored on your device. If one is not detected, you will be redirected to login.html. Otherwise, the page will display some user data at the top. This includes the catalogue page, which is the key used to access each product in the database. Below this is an image whose URL and description from the models table, as well as three forms. The "Next Page" button will increment the page number cookie by 1 and reload the page. The "Previous Page" button will do the same, but instead de-increment the page number cookie. The "Purchase" button activates purchase.php, which checks if you don't already own the product, as well as whether you have the neccessary funds to buy it. Once both these criteria have been satisfied, it will perform a transaction to subrtract funds from your account in the customers table, and associate your email with the product page number in the model_email table befroe redirecting you back to the page you were just on.