This is for a homework assignment for Wesleyan University, COMP333 Software Engineering.
This is for the first assignment of Wesleyan University, COMP333 Software Engineering. The website is the landing page of a fictional app: WesDash.
Ada Qin: Navigation bar/ Our Strength and Technology/Hyperlink(4)/Style adjustment/Log in Haihan Wang: Hero section/ How it works/Style adjustment Cheruiyot Allan: Customer Reviews/Style adjustment
The Code’s purpose is to create a landing page for a functional app: WesDash. WesDash is a campus delivery service built for students that is designed to provide fast and easy shopping and delivery services on a university campus.
The current repository contains the main page to introduce how WesDash works, including the content of How does app works, the login section, the strength and technology in the app, and the reviews from users, decorated with a hero section, slogan, etc.
The important files are:
index.html: The homepage of the WesDash website. This page contains key features like the navigation bar, hero section, “How It Works”, advert slogans, signup form, and customer reviews.
contract.html: A page displaying the contract and terms of service for users of WesDash, including the responsibilities of Buyers, Shoppers, and all Users.
Price_list.html: A page displaying the charging of using the app, including the detailed price and description of different service
styles.css: The main stylesheet used for styling both the main page and contract page, containing a responsive design, color scheme, and layout definitions.
git clone https://github.com/AdaTsanQin/COMP333.gitcd COMP333COMP333 folder and click index.html to see the page.Mistakes and actions made while using Github:

Change line 80 in dashboard.html from
<a href="update.php">Update Order</a> to
<a href="update_task.php">Update Order</a>
NOTE: The order must have a ‘complete’ status before adding a review. For this to happen, you must use ‘Drop Off’ button from the Dashboard.
People who register the program can log in and out of the program repeatedly. As a Buyer, the user can request someone to run errands for him: create a new order, fill in the detailed product name and address in the order, and always check whether someone has accepted the order and whether it has been delivered. There will be a prompt when the order is delivered. After confirming the items, the Buyer ends the order. At the same time, as a Runner, you can also view the currently accepted orders, accept the orders, and send them to the Buyer at a certain time.
Ada: register/ request of Buyer / request of Runner / Readme / deployment in infinityfree Haihan: login.php, create.php, read.php, updata.php(some part) Allan: create,update,delete reviews/ Dashboard page
CREATE TABLE users ( username VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, is_deleted TINYINT(1) DEFAULT 0, PRIMARY KEY (username) );
CREATE TABLE requests ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL, item VARCHAR(255) NOT NULL, drop_off_location VARCHAR(255) NOT NULL, delivery_speed ENUM(‘urgent’, ‘common’) DEFAULT ‘common’, status ENUM(‘pending’, ‘accepted’, ‘completed’, ‘confirmed’) NOT NULL DEFAULT ‘pending’, created_at DATETIME NOT NULL, accepted_by VARCHAR(255) DEFAULT NULL,
CONSTRAINT fk_requests_username
FOREIGN KEY (username)
REFERENCES users(username)
ON UPDATE CASCADE
ON DELETE RESTRICT );
ada-qin.ct.ws not done but tried to set up the SSL Having following : Installed SSL Status This is the SSL certificate that’s installed on your hosting account.
Status Issuer Google Trust Services Expires at 2025-06-05
1.Ada:

Haihan Wang: 
This repository contains both a React Native frontend (for iOS/Android) and a PHP/MySQL backend. The app supports: Account Management: Create user accounts, log in, log out, delete accounts/Requests Management (CRUD): Create, read, edit (update), and delete requests/ Order Flow: Accept order, drop off order, and confirm status changes
We have also partially tested deployment via InfinityFree hosting (see InfinityFree below). The following sections explain how to set up the project locally, how the database is structured, and how to run the code.
WesDash/
├── .expo/
├── .idea/
├── assets/
├── node_modules/
├── screen/
│ ├── AcceptOrderScreen.js
│ ├── CreateRequestScreen.js
│ ├── DashboardScreen.js
│ ├── HomeScreen.js
│ ├── LoginScreen.js
│ ├── RegisterScreen.js
│ ├── ViewRequestScreen.js
├── App.js
├── package.json
.
.
.
Note: the project run by opening the main branch file in Android Studio
Applications/XAMPP/xamppfiles/htdocs/
├── WesDashAPI/
│ ├── accpte_order.php
│ ├── accpte_requests.php
│ ├── create_requests.php
│ ├── edit.php
│ ├── login.php
│ ├── register.php
│ ├── delete_user.php
Note: downlaod all the files in main that are in WesDashAPI, create a WesDashAPI under htcods folder, and put all the files downloaded from WesDashPAI folder in main.
A. Database & PHP (Backend)
CREATE TABLE requests ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL, item VARCHAR(255) NOT NULL, drop_off_location VARCHAR(255) NOT NULL, delivery_speed ENUM(‘urgent’, ‘common’) DEFAULT ‘common’, status ENUM(‘pending’, ‘accepted’, ‘completed’, ‘confirmed’) NOT NULL DEFAULT ‘pending’, created_at DATETIME NOT NULL, accepted_by VARCHAR(255) DEFAULT NULL,
CONSTRAINT fk_requests_username
FOREIGN KEY (username)
REFERENCES users(username)
ON UPDATE CASCADE
ON DELETE RESTRICT );
Create table tasks:
CREATE TABLE tasks(task_id INT(11) NOT NULL AUTO_INCREMENT,request_id INT(11) DEFAULT NULL,username VARCHAR(255) DEFAULT ' ',dashername VARCHAR(255) DEFAULT ' ',item TEXT,status VARCHAR(50) DEFAULT ' ', rating INT(11) DEFAULT 0,comment TEXT DEFAULT ' ', PRIMARY KEY (task_id) );
B.Frontend / React Native
there are two ways to run the project:
1. Navigate into the main branch folder.
rm -rf node_modules package-lock.json
npm install
npx expo start
a
2. You can create a folder named WesDash and consider it as the frontend folder.
Configure the WesDash folder according to the strcutre below. All necessary files can be found in the main branch.
WesDash/
├── .expo/
├── .idea/
├── assets/
├── node_modules/
├── screen/
│ ├── AcceptOrderScreen.js
│ ├── CreateRequestScreen.js
│ ├── DashboardScreen.js
│ ├── HomeScreen.js
│ ├── LoginScreen.js
│ ├── RegisterScreen.js
│ ├── ViewRequestScreen.js
├── App.js
├── package.json
.
.
.
Note: the project run by opening the main branch file in Android Studio
Applications/XAMPP/xamppfiles/htdocs/
├── WesDashAPI/
│ ├── accpte_order.php
│ ├── accpte_requests.php
│ ├── create_requests.php
│ ├── edit.php
│ ├── login.php
│ ├── register.php
│ ├── delete_user.php
Note: downlaod all the files in main that are in WesDashAPI, create a WesDashAPI under htcods folder, and put all the files downloaded from WesDashPAI folder in main.
cd WesDash
npm install
npx expo start
a
Or if React Native CLI:
npx react-native start
IP addresses: In your JS files, you may see fetch(“http://10.0.2.2/…”). This is necessary for Android emulators to reach your local PHP server. If you run on a real device, you must replace 10.0.2.2 with your LAN IP.
if you encountered any issue by using command line above, please first run: ‘rm -rf node_modules package-lock.json’ then ‘start with npx expo start’
1.Start Apache & MySQL (XAMPP).
2.Start React Native server (Expo or CLI).
3.Launch your Android emulator (Pixel 6A, API 34) or plug in a physical device with USB debugging enabled.
4.In your emulator, run the app. Confirm the requests are reaching your local PHP server.
Example flows:
register.php)login.php), which sets a session cookieedit.php)register.phpPOSTlogin.phpPOSTPOSTPUTPUTGETPUT body { “id”: 123 } -> sets status to ‘accepted’
PUT body { “id”: 123, “action”: “drop_off” } -> sets status to ‘completed’
HaihanWang:

Ada:

Allan:

Applications/XAMPP/xamppfiles/htdocs/
├── WesDashAPI/
│ ├── accept_order.php
│ ├── accept_requests.php
│ ├── create_requests.php
│ ├── edit.php
│ ├── login.php
│ ├── register.php
│ ├── delete_user.php
│ ├── …
│ └── tests-project/
│ ├── composer.json
│ ├── composer.lock
│ ├── vendor/
│ └── test/
│ └── UserTest.php
Where UserTest.php contains all 4 required tests
base_uri in the tests).app-db in phpMyAdmin.CREATE TABLE requests (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
item VARCHAR(255) NOT NULL,
quantity INT NOT NULL DEFAULT 1,
is_custom TINYINT(1) NOT NULL DEFAULT 0,
est_price DECIMAL(10,2) DEFAULT NULL,
purchase_mode VARCHAR(255) DEFAULT NULL,
drop_off_location VARCHAR(255) NOT NULL,
delivery_speed ENUM(‘urgent’,’common’) NOT NULL DEFAULT ‘common’,
status ENUM(‘pending’,’accepted’,’completed’,’confirmed’)
NOT NULL DEFAULT ‘pending’,
accepted_by VARCHAR(255) DEFAULT NULL,
total_price DECIMAL(10,2) NOT NULL DEFAULT 0.00,
real_price DECIMAL(10,2) DEFAULT NULL,
receipt_photo VARCHAR(255) DEFAULT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
review_prompt_status VARCHAR(50) DEFAULT ‘pending’,
CONSTRAINT fk_requests_user
FOREIGN KEY (username)
REFERENCES users(username) ON DELETE CASCADE,
INDEX idx_status (status),
INDEX idx_dasher (accepted_by) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE chat_rooms ( id INT AUTO_INCREMENT PRIMARY KEY, order_id INT NOT NULL, user_name VARCHAR(255) NOT NULL, dasher_name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, closed_at DATETIME NULL, INDEX(order_id), CONSTRAINT fk_room_req FOREIGN KEY (order_id) REFERENCES requests(id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE chat_messages ( id INT AUTO_INCREMENT PRIMARY KEY, room_id INT NOT NULL, sender VARCHAR(255) NOT NULL, message TEXT NOT NULL, sent_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX idx_room_time (room_id, sent_at), CONSTRAINT fk_msg_room FOREIGN KEY (room_id) REFERENCES chat_rooms(id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE tips (
id INT AUTO_INCREMENT PRIMARY KEY,
request_id INT NOT NULL,
amount INT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_tip_req
FOREIGN KEY (request_id) REFERENCES requests(id)
ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE recharges (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
amount INT NOT NULL,
stripe_pi VARCHAR(255) NULL,
status ENUM(‘pending’,’succeeded’,’failed’)
NOT NULL DEFAULT ‘pending’,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_recharge_user FOREIGN KEY (username)
REFERENCES users(username) ON DELETE CASCADE
) ENGINE=InnoDB CHARSET=utf8mb4;
CREATE TABLE reviews ( id INT(11) NOT NULL AUTO_INCREMENT, order_id INT(11) NOT NULL, review_text TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, rating INT(11) NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY (id), INDEX idx_order_id (order_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
4. Insert a test user (needed for valid‑login):
```sql
INSERT INTO users
VALUES ('testuser', PASSWORD('password123'), 0);
register.php—-GET returns full user list 200. register.php—-POST creates user 201 (already implemented). login.php—-Return 201 on both successful and failed logins (per assignment).
git clone cd COMP333(main branch)
cp -r WesDashAPI /Applications/XAMPP/xamppfiles/htdocs/
cd WesDashAPI/tests-project composer install # installs PHPUnit + Guzzle
php vendor/bin/phpunit test
PHPUnit 12.x by Sebastian Bergmann and contributors.
…. 4 / 4 (100%)
Time: 00:00.x, Memory: 8.00 MB
OK (4 tests, 4 assertions)
'drop_off_location'=>'Office', 'item'=>'Banana', 'quantity'=>3, 'total_price'=>4.20 quantity is mismatching, and suggesting to change '$input['quantity'] === "3"' to 'quantity' => 3 GPT Response:
Possible Ways to Resolve It:
In Summary:
Map Alternatives:
User: Is there any other map alternatives that I can use except Google?
GPT Response: Yes, there are several alternatives to Google Maps API for integrating maps into your application. Here are some popular alternatives:
react-native-mapbox-gl for integrating Mapbox into a React Native app.react-native-mapbox-gl package to start integrating Mapbox.
npm install @react-native-mapbox-gl/maps
react-native-maps with OpenStreetMap tiles.react-native-maps by using OSM as the tile source:
<MapView provider={PROVIDER_DEFAULT} customMapStyle={osmStyle}>
<Marker coordinate= />
</MapView>
react-leaflet (for web apps) or integrate Leaflet with React Native using a WebView or native integration.react-native-here-maps for integrating Here Maps with React Native.Choosing the Right Map for Your App:
Let me know if you need help integrating any of these alternatives into your app!
User: Why is the edit.php not working properly? Where might the problem lie around these lines?
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
if (empty($data['id']) || empty($data['item']) || empty($data['drop_off_location']) || empty($data['delivery_speed']) || empty($data['status'])) {
echo json_encode([
"success" => false,
"message" => "Missing required fields."
]);
exit;
}
$id = (int)$data['id'];
$item = $data['item'];
$drop_off_location = $data['drop_off_location'];
$delivery_speed = $data['delivery_speed'];
$status = $data['status'];
$sql = "UPDATE requests
SET item = ?,
drop_off_location = ?,
delivery_speed = ?,
status = ?
WHERE id = ? AND username = ?";
$stmt = $conn->prepare($sql);
if (!$stmt) {
echo json_encode([
"success" => false,
"message" => "Failed to prepare statement: " . $conn->error
]);
exit;
}
$stmt->bind_param("ssssis", $item, $drop_off_location, $delivery_speed, $status, $id, $username);
}
**GPT Response:** ### Ensure Correct Data Types:
Make sure the data types in bind_param match the types of the variables. The bind_param method uses the following format:
s for stringsi for integersd for doubles (floats)b for blobs (binary data)If item, drop_off_location, delivery_speed, status, id, and username are all strings (except id, if it’s an integer), you might want to modify the data types accordingly:
$stmt->bind_param("ssssis", $item, $drop_off_location, $delivery_speed, $status, $id, $username);
1.Create a account in https://stripe.com
2.Click Dashboard in navigation bar, then you could see a box in right side of screen saying API keys
(Notice the key might be different every day, recheck even you already set up key last time)
3.Copy the publishable key in to line 37 of App.js
<StripeProvider publishableKey="pk_test_•••YOUR_PUBLISHABLE_KEY•••">
4.Copy the Secret key into the create-payment-intent.php line 43
\Stripe\Stripe::setApiKey('sk_test_•••YOUR_SECRET_KEY•••');
5.In terminal, run the following,where GitHubUsername should be your github username with all lowercase:
,,,
cd /Applications/XAMPP/xamppfiles/htdocs/WesDashAPI
composer init –name=”GitHubUsername/wesdashapi” –require=”stripe/stripe-php:^10.0” –no-interaction
composer require stripe/stripe-php
,,,
6.Create a secrets.php under htdocs/WesDashAPI with following content:
replace the text YOUR_SECRET_KEY with the secrete key you have in stripe website
<?php
// File: /Applications/XAMPP/xamppfiles/htdocs/WesDashAPI/secrets.php<br>
// Your Stripe Secret Key<br>
$stripeSecretKey = 'YOUR_SECRET_KEY';
git checkout main
cp -r WesDashAPI /Applications/XAMPP/xamppfiles/htdocs/
choose open→ COMP333(main branch folder)
npm install
npm run android
To simulate a location on the Android emulator for convenient map testing:
Start the emulator from Android Studio.
In the emulator window, click the three-dot menu icon on the right side.
(Hovering over it will show: Extended controls, not the one shows options)
In the left sidebar of the Extended Controls window, select Location.
In the location search bar, enter a place name, such as Wesleyan University.
Click the Save Point button.
A pop-up titled “Save route as” will appear — just click OK to confirm.
On the right-hand panel, under Saved Points, select the newly saved location.
Finally, click Set Location to update the emulator’s GPS position.
The map in your app will now respond as if the emulator is physically located at the selected point.
Do not use a real card.
Use the Stripe test card:
4242 4242 4242 4242
Enter any future date (e.g., 03 / 27), any 3-digit CVC (e.g., 120) and any Postal code (e.g., 06457)
git checkout main
ipconfig getifaddr en0
to get ip address, copy the ip address into config.js, put it into “IP_ADDRESS”
// config.js
export const DEV_HOST = 'IP_ADDRESS';
export const BASE_URL = `http://${DEV_HOST}/WesDashAPI`;
npx expo install expo@^53.0.0
npx expo install --fix
npx expo start