diff --git a/README.md b/README.md index d686cfbeb6d1fdcaa7d77b762d9b4a64dd9ff2b7..e71f150bb5d586da900b41054a0a4a0fc310ee9b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,18 @@ -php -S localhost:8080 -c "C:\Users\ASUS\Downloads\php-8.2.10-Win32-vs16-x64\php.INI-DEVELOPMENT" - # Deskripsi aplikasi web Aplikasi Kuchenk Guide adalah sebuah aplikasi web yang dibangun menggunakan PHP untuk bagian backend dan HTML, CSS, serta JavaScript untuk bagian frontend. Aplikasi ini bertujuan untuk memberikan informasi mengenai kucing liar (kuchenk) di Institut Teknologi Bandung (ITB). Pengguna dapat menjelajahi kampus, menemukan informasi lengkap mengenai kuchenk gemuk yang menghuni ITB, seperti profil, lokasi favorit, dan juga berbagi foto jika mereka bertemu dengan kuchenk2 ITB yang gemuk nan gemoy. +Unauthenticated user: +1. Melihat isi dari website + +Authenticated user: +1. Melihat directory/database kucing +2. Menambahkan foto kucing pada sightings jika mereka bertemu kucing tersebut, CRUD pada resource mereka sendiri. + +Admin: +1. CRUD directory/database kucing. +2. RUD Users +3. CRUD Sightings. + # Daftar requirement 1. PHP 2. MySql @@ -10,6 +20,7 @@ Aplikasi Kuchenk Guide adalah sebuah aplikasi web yang dibangun menggunakan PHP # Cara instalasi 1. Install PHP dari file situs resmi https://www.php.net/downloads.php 2. Download MySQL dan setup config yang tepat di config.php +3. Docker jika ingin menggunakan docker # Jika menggunakan docker 1. Pastikan docker sudah terpasang pada perangkat anda @@ -18,31 +29,61 @@ Aplikasi Kuchenk Guide adalah sebuah aplikasi web yang dibangun menggunakan PHP 4. Buka browser dan arahkan ke address `localhost:8081` # Cara menjalankan server -1. Ganti file config.php dengan konfigurasi tepat anda. -## Reguler -2. Jika menggunakan PHP, silahkan jalankan command `php -S localhost:8080` -##Docker -2. - -# Tangkapan layar tampilan aplikasi (tidak perlu semua kasus, minimal 1 per halaman), dan +1. Jika menggunakan PHP, silahkan jalankan command `php -S localhost:8080` +## Docker +2. Jika menggunakan docker, Jalankan perintah `docker compose up -d` + +# Tangkapan layar tampilan aplikasi (tidak perlu semua kasus, minimal 1 per halaman). (Sekaligus bonus responsif) +## Login dan Register + + +## Home Page + + +## Database Kucing + + + +## Melihat sightings dari kucing specifik, Menambahkan Sightings + + + +## Sightings semua kucing + + +## Menambahkan Sightings, Menghapus / Edit Sighting yang ditambahkan sendiri oleh user. + + + + +## Page users untuk Admin + + +## Admin dapat melakukan CRUD pada cats, sightings + + # Penjelasan mengenai pembagian tugas masing-masing anggota (lihat formatnya pada bagian pembagian tugas). -Client-Side +13521123 -> William +13521105 -> Haidar +13521117 -> Maggie -Login: 13521105 -Register: 13521117 -Cats: 13521123 -Sightings: 13521105 -Users: 13521123 +Client-Side: +- Login: 13521105 +- Register: 13521117 +- Cats: 13521123 +- Sightings: 13521105 +- Users: 13521123 Server-Side: -Login: 13521105 -Register: 13521117 -Cats: 13521123 -Sightings: 13521105 -Users: 13521123 +- Login: 13521105 +- Register: 13521117 +- Cats: 13521123 +- Sightings: 13521105 +- Users: 13521123 -setup docker: 13521105 +Setup Docker: +- 13521105 # Bonus: Light house @@ -59,4 +100,7 @@ setup docker: 13521105  ## Login Page (/login) - \ No newline at end of file + + +## Register Page (/register) + \ No newline at end of file diff --git a/docs/image-1.png b/docs/image-1.png new file mode 100644 index 0000000000000000000000000000000000000000..6de9dcbee819956d153b07509c33335a11f762db Binary files /dev/null and b/docs/image-1.png differ diff --git a/docs/image-10.png b/docs/image-10.png new file mode 100644 index 0000000000000000000000000000000000000000..7138ec488b17e2cea7908f35abe8285ec08d470c Binary files /dev/null and b/docs/image-10.png differ diff --git a/docs/image-11.png b/docs/image-11.png new file mode 100644 index 0000000000000000000000000000000000000000..3217e16af7ab44065765240842c7e14b9b7b893b Binary files /dev/null and b/docs/image-11.png differ diff --git a/docs/image-12.png b/docs/image-12.png new file mode 100644 index 0000000000000000000000000000000000000000..f64cf0bfe4139cbbda65a02ec1db5c7ebf686723 Binary files /dev/null and b/docs/image-12.png differ diff --git a/docs/image-13.png b/docs/image-13.png new file mode 100644 index 0000000000000000000000000000000000000000..196741960e967d1afc0eb80c93cbc3b299b71238 Binary files /dev/null and b/docs/image-13.png differ diff --git a/docs/image-14.png b/docs/image-14.png new file mode 100644 index 0000000000000000000000000000000000000000..fd94729ebaba1bd83722be6b3550c224100afde0 Binary files /dev/null and b/docs/image-14.png differ diff --git a/docs/image-15.png b/docs/image-15.png new file mode 100644 index 0000000000000000000000000000000000000000..d8257e1cd4a15e68282bc408d170ed3f8072085b Binary files /dev/null and b/docs/image-15.png differ diff --git a/docs/image-16.png b/docs/image-16.png new file mode 100644 index 0000000000000000000000000000000000000000..9660ed48b0563a8c60eef9f87ae15214279b4f2f Binary files /dev/null and b/docs/image-16.png differ diff --git a/docs/image-2.png b/docs/image-2.png new file mode 100644 index 0000000000000000000000000000000000000000..fc0cb82a319bbd226f72d8a75d0088df4784dcf7 Binary files /dev/null and b/docs/image-2.png differ diff --git a/docs/image-3.png b/docs/image-3.png new file mode 100644 index 0000000000000000000000000000000000000000..a4f6800271d911d4d26ac64ed2127ca08d015268 Binary files /dev/null and b/docs/image-3.png differ diff --git a/docs/image-4.png b/docs/image-4.png new file mode 100644 index 0000000000000000000000000000000000000000..99d63b9ded617ff90c3f5ee2cd8c962f3c2ddac6 Binary files /dev/null and b/docs/image-4.png differ diff --git a/docs/image-5.png b/docs/image-5.png new file mode 100644 index 0000000000000000000000000000000000000000..c3d0f4829fcb4e1a7b344b7a9e8cec9e460c9a5d Binary files /dev/null and b/docs/image-5.png differ diff --git a/docs/image-6.png b/docs/image-6.png new file mode 100644 index 0000000000000000000000000000000000000000..e6f9141058f72de9a72c54c5cd40b171373abc48 Binary files /dev/null and b/docs/image-6.png differ diff --git a/docs/image-7.png b/docs/image-7.png new file mode 100644 index 0000000000000000000000000000000000000000..901d59c3c6446093aa0c9f62225c12748ea00f8b Binary files /dev/null and b/docs/image-7.png differ diff --git a/docs/image-8.png b/docs/image-8.png new file mode 100644 index 0000000000000000000000000000000000000000..802ef52fbbfdca6b717e61b3f45f59bdb4327bdd Binary files /dev/null and b/docs/image-8.png differ diff --git a/docs/image-9.png b/docs/image-9.png new file mode 100644 index 0000000000000000000000000000000000000000..152e1cedbb7bc135b6c6948f7d7bbf10c775c418 Binary files /dev/null and b/docs/image-9.png differ diff --git a/docs/image.png b/docs/image.png new file mode 100644 index 0000000000000000000000000000000000000000..23ec31fd123ce264c368f316687290ed9de4d03c Binary files /dev/null and b/docs/image.png differ diff --git a/index.php b/index.php index f0210a8c6bbbcbdd7f79ab408b051334a5ba1aef..9342ee3c65dfa03a8690b877d904aec8c8b84dd9 100644 --- a/index.php +++ b/index.php @@ -21,11 +21,12 @@ $router->route("/login", LoginController::getInstance(), []); $router->route("/register", RegisterController::getInstance(), []); $router->route("/logout", LogoutController::getInstance(), []); -$router->route("/cat", CatController::getInstance(), []); -$router->route("/cat/*", CatController::getInstance(), []); +$router->route("/cat", CatController::getInstance(), ["POST" => "auth", "PUT" => "auth", "DELETE" => "auth"]); +$router->route("/cat/*", CatController::getInstance(), ["POST" => "auth", "PUT" => "auth", "DELETE" => "auth"]); -$router->route("/sighting", SightingController::getInstance(), []); -$router->route("/sighting/*", SightingController::getInstance(), []); +$router->route("/sighting", SightingController::getInstance(), ["POST" => "auth", "PUT" => "auth", "DELETE" => "auth"]); +$router->route("/sighting/*", SightingController::getInstance(), ["POST" => "auth", "PUT" => "auth", "DELETE" => "auth"]); $router->route("/user", UserController::getInstance(), ["GET" => "admin"]); $router->route("/user/*", UserController::getInstance(), ["POST" => "admin", "PUT" => "admin", "DELETE" => "admin"]); + $router->run($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']); \ No newline at end of file diff --git a/migrations/migrate.sql b/migrations/migrate.sql index f1820ecfb504d3d9f5b4f21fc4c9c822422dd7dc..c60d8181b09e53e4413c7571222bbec0f7a413d5 100644 --- a/migrations/migrate.sql +++ b/migrations/migrate.sql @@ -1,3 +1,5 @@ +drop table if exists sightings; +drop table if exists cats; drop table if exists users; -- Users Table CREATE TABLE users ( @@ -10,10 +12,10 @@ CREATE TABLE users ( registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); INSERT INTO users (user_id, nama, username, password, email, isAdmin) VALUES -(1,'ujang','unjanx','p','p@gmail.com',1); +(1,'Roga','Roga','$2y$10$HLwQODDVcroIcYVs/vPL6.dmo0fl.7j/rjkXlcjdJeqoAOx7NgfLS','p@gmail.com',1), +(2,'Saroga','Saroga','$2y$10$HLwQODDVcroIcYVs/vPL6.dmo0fl.7j/rjkXlcjdJeqoAOx7NgfLS','p2@gmail.com',1); -drop table if exists cats; -- Cats Table CREATE TABLE cats ( cat_id INT PRIMARY KEY AUTO_INCREMENT, @@ -28,52 +30,51 @@ CREATE TABLE cats ( cat_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -INSERT INTO cats (cat_id, name, description, location, gender, color, spayed, sound_path, image_path, cat_added) VALUES -(1, 'Whiskers', 'A friendly and playful cat', 'Living room', 'Male', 'Tabby', 'Yes', '/sounds/whiskers.mp3', '/images/whiskers.jpg', '2023-09-30 10:00:00'), -(2, 'Fluffy', 'Loves to nap and cuddle', 'Bedroom', 'Female', 'White', 'No', '/sounds/fluffy.mp3', '/images/fluffy.jpg', '2023-09-30 10:15:00'), -(3, 'Leo', 'An adventurous outdoor cat', 'Backyard', 'Male', 'Orange', 'Yes', '/sounds/leo.mp3', '/images/leo.jpg', '2023-09-30 10:30:00'), -(4, 'Mittens', 'Always ready to play fetch', 'Playroom', 'Female', 'Calico', 'No', '/sounds/mittens.mp3', '/images/mittens.jpg', '2023-09-30 10:45:00'), -(5, 'Shadow', 'Mysterious and quiet', 'Basement', 'Male', 'Black', 'Yes', '/sounds/shadow.mp3', '/images/shadow.jpg', '2023-09-30 11:00:00'); - +INSERT INTO cats (name, description, location, gender, color, spayed, sound_path, image_path) VALUES +('Chong Fen', 'A playful and curious kitty', 'Sabuga', 'Male', 'Tabby', 'Yes', '/sounds/fluffy.mp3', '/images/cat01.jpg'), +('Klepon', 'Loves to explore and hide', 'Saraga', 'Female', 'White', 'No', '/sounds/fluffy copy.mp3', '/images/cat02.jpg'), +('Nutella', 'Sweet and cuddly', 'Labtek I', 'Male', 'Orange', 'Yes', '/sounds/fluffy copy 2.mp3', '/images/cat03.jpg'), +('Cendol', 'Enjoys sunbathing', 'Labtek II', 'Female', 'Calico', 'No', '/sounds/fluffy copy 3.mp3', '/images/cat04.jpg'), +('Butter Ball', 'Always ready for treats', 'Labtek III', 'Male', 'Black', 'Yes', '/sounds/fluffy copy 4.mp3', '/images/cat05.jpg'), +('Mochi', 'Loves to play with string toys', 'Sabuga', 'Female', 'Gray', 'No', '/sounds/fluffy copy 5.mp3', '/images/cat06.jpg'), +('Pandan', 'Has a soft spot for cuddles', 'Saraga', 'Male', 'Siamese', 'Yes', '/sounds/fluffy copy 6.mp3', '/images/cat07.jpg'), +('Gembul', 'A spicy little explorer', 'Labtek IV', 'Female', 'Tortoiseshell', 'No', '/sounds/fluffy copy 7.mp3', '/images/cat08.jpg'), +('Gado-Gado', 'Friendly and sociable', 'Labtek V', 'Male', 'Brown', 'Yes', '/sounds/fluffy copy 8.mp3', '/images/cat09.jpg'), +('Durian', 'A quirky and independent cat', 'Labtek VI', 'Female', 'Cream', 'No', '/sounds/fluffy copy 9.mp3', '/images/cat10.jpg'), +('Sapi', 'Always ready for a game of chase', 'Saraga', 'Male', 'Ginger', 'Yes', '/sounds/fluffy copy 10.mp3', '/images/cat11.jpg'), +('Pisang', 'Loves climbing and exploring', 'Labtek VII', 'Female', 'Tabby', 'No', '/sounds/fluffy copy 11.mp3', '/images/cat12.jpg'), +('Rendang', 'A fierce and fearless hunter', 'Sabuga', 'Male', 'Black', 'Yes', '/sounds/fluffy copy 12.mp3', '/images/cat13.jpg'), +('Teh Tarik', 'Gentle and easygoing', 'Labtek VIII', 'Female', 'White', 'No', '/sounds/fluffy copy 13.mp3', '/images/cat14.jpg'), +('Bakso', 'Enjoys lazy afternoons in the sun', 'Labtek IX', 'Male', 'Gray', 'Yes', '/sounds/fluffy copy 14.mp3', '/images/cat15.jpg'); -- Sightings Table CREATE TABLE sightings ( sighting_id INT PRIMARY KEY AUTO_INCREMENT, - cat_id INT REFERENCES cats(cat_id), - user_id INT REFERENCES users(user_id), + cat_id INT, + user_id INT, sighting_location VARCHAR(255) NOT NULL, date DATE, time TIME, sighting_description TEXT, - image_url TEXT -- URL to image related to the sighting + image_url TEXT, + FOREIGN KEY (cat_id) REFERENCES cats(cat_id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ); -INSERT INTO sightings (sighting_id,cat_id,user_id,sighting_location,date,time,sighting_description,image_url) VALUES -(1,1,1,'loc','2023-10-1','10:00:00','ppp','/images/whiskers.jpg'), -(2,2,1,'loc2','2023-10-1','10:00:00','ppp','/images/whiskers.jpg'); - - -## HOME PAGE - -## LOGIN PAGE - -## REGISTER - -## Page spesifik kucing - -## ADMIN - - -Backend -HOME -SIGHTHINGS -LOGIN/REG - -ADMIN - - -Frontend -HOME -SIGHTINGS -LOGIN/REG -ADMIN +INSERT INTO sightings (cat_id, user_id, sighting_location, date, time, sighting_description, image_url) +VALUES + (1, 1, 'Labtek I', '2023-10-01', '10:00:00', 'Eating', '/images/cat01.jpg'), + (2, 2, 'Labtek II', '2023-10-02', '11:00:00', 'Sleeping', '/images/cat02.jpg'), + (3, 1, 'Labtek III', '2023-10-03', '12:00:00', 'Playing', '/images/cat03.jpg'), + (4, 2, 'Labtek IV', '2023-10-04', '13:00:00', 'Exploring', '/images/cat04.jpg'), + (5, 1, 'Labtek V', '2023-10-05', '14:00:00', 'Relaxing', '/images/cat05.jpg'), + (1, 2, 'Labtek VI', '2023-10-06', '15:00:00', 'Hunting', '/images/cat01.jpg'), + (2, 1, 'Labtek VII', '2023-10-07', '16:00:00', 'Climbing', '/images/cat02.jpg'), + (3, 2, 'Labtek VIII', '2023-10-08', '17:00:00', 'Grooming', '/images/cat03.jpg'), + (4, 1, 'Labtek IX', '2023-10-09', '18:00:00', 'Chasing', '/images/cat04.jpg'), + (5, 2, 'Labtek X', '2023-10-10', '19:00:00', 'Lounging', '/images/cat05.jpg'), + (1, 1, 'Labtek I', '2023-10-11', '20:00:00', 'Pouncing', '/images/cat01.jpg'), + (2, 2, 'Labtek II', '2023-10-12', '21:00:00', 'Napping', '/images/cat02.jpg'), + (3, 1, 'Labtek III', '2023-10-13', '22:00:00', 'Exploring', '/images/cat03.jpg'), + (4, 2, 'Labtek IV', '2023-10-14', '23:00:00', 'Sleeping', '/images/cat04.jpg'), + (5, 1, 'Labtek V', '2023-10-15', '00:00:00', 'Relaxing', '/images/cat05.jpg'); diff --git a/public/components/Navbar.php b/public/components/Navbar.php index 53d7b0a20a6863c1db4da2a7f21639ef10ffca73..2e4a63747b9a6555556351a88b0fddc2322608a3 100644 --- a/public/components/Navbar.php +++ b/public/components/Navbar.php @@ -11,7 +11,7 @@ } if ($loggedIn) { echo '<li><a href="/logout">Logout</a></li>'; - echo '<li class="user-info">Welcome, ' . $_SESSION['username'] . '<br> Role: ' . ($isAdmin ? 'Admin' : 'User') . '</li>'; + echo '<li>Hi, ' . $_SESSION['username'] . ($isAdmin ? ' (Admin)' : ' (User)') . '</li>'; } else { echo '<li><a href="/register">Register</a></li>'; echo '<li><a href="/login">Login</a></li>'; diff --git a/public/components/Pagination.php b/public/components/Pagination.php index 958ac59f3fd7d973b4c3ff733790b7efd0f8aa6d..23188d9f4aa24f8722a7b71bf343a90d20165fb8 100644 --- a/public/components/Pagination.php +++ b/public/components/Pagination.php @@ -82,7 +82,7 @@ $currentPage = isset($_GET['pageNo']) ? intval($_GET['pageNo']) : 1; // Check if the current URL is /cats $currentUrl = $_SERVER['REQUEST_URI']; -$isCatsPage = strpos($currentUrl, '/cats') !== false; +$isCatsPage = strpos($currentUrl, '/cat') !== false; if ($isCatsPage) { // Extract and preserve query parameters diff --git a/public/css/login.css b/public/css/login.css index 8fc86cc108f8e82a2fc629d183223bbddcc720b9..a3661b986962221347e1a0f471fcf2d0525c9b37 100644 --- a/public/css/login.css +++ b/public/css/login.css @@ -12,8 +12,8 @@ background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); border-radius: 5px; - padding: 70px; - margin: 20px; + padding: 50px; + margin: 10px; width: 350px; text-align: center; } @@ -40,12 +40,12 @@ .login-label, .register-label { font-size: 16px; display: block; - margin-bottom: 5px; + margin-bottom: 2px; } .login-input, .register-input { width: 100%; - height: 40px; + height: 30px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; diff --git a/public/css/styles.css b/public/css/styles.css index 7c76807e47b4a7cdda68de599dc7f829048163e1..5a367d274b7095b612ecb3eda523918b129d58c3 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -484,7 +484,7 @@ button[type="submit"] { .cat-cards-container, .sighting-cards-container, .user-cards-container { display: grid; - grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); + grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); grid-gap: 16px; margin: 10px; } @@ -617,13 +617,9 @@ nav ul { list-style: none; padding: 0; display: flex; - justify-content: flex-end; /* Align items to the right */ + justify-content: flex-start; /* Align items to the right */ } nav li { margin-left: 10px; /* Add some spacing between list items */ -} - -.user-info { - margin-left: auto; /* Push user info to the right */ -} +} \ No newline at end of file diff --git a/public/images/accuracy_bar.png b/public/images/accuracy_bar.png deleted file mode 100644 index fd8a4e1ff0b0263ac552b8428b385cfb75767716..0000000000000000000000000000000000000000 Binary files a/public/images/accuracy_bar.png and /dev/null differ diff --git a/public/images/cat01.jpg b/public/images/cat01.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e1e9fe7d5638a7ea6bdcafbb088571990d8b2056 Binary files /dev/null and b/public/images/cat01.jpg differ diff --git a/public/images/cat02.jpeg b/public/images/cat02.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..c749f257c12af1fb730ace8833b2915908a3ccc4 Binary files /dev/null and b/public/images/cat02.jpeg differ diff --git a/public/images/cat02.jpg b/public/images/cat02.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ad92e98ee708d45a152445bdbec58d191103b2e Binary files /dev/null and b/public/images/cat02.jpg differ diff --git a/public/images/cat03.jpg b/public/images/cat03.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b899c89e5e734768db7da31e751564862186b90c Binary files /dev/null and b/public/images/cat03.jpg differ diff --git a/public/images/cat04.jpg b/public/images/cat04.jpg new file mode 100644 index 0000000000000000000000000000000000000000..34ebe3249080afbaeae33f00d13125a9cfdf328a Binary files /dev/null and b/public/images/cat04.jpg differ diff --git a/public/images/cat05.jpg b/public/images/cat05.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1559b18c5a412406f04fd8c50daefa7158f97f62 Binary files /dev/null and b/public/images/cat05.jpg differ diff --git a/public/images/cat06.jpg b/public/images/cat06.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1fb196229e998d9e9479454395054f5afdea6ce0 Binary files /dev/null and b/public/images/cat06.jpg differ diff --git a/public/images/cat07.jpg b/public/images/cat07.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ad0f6ad7309e1c6252f45fc6b34cc22cf4c0841 Binary files /dev/null and b/public/images/cat07.jpg differ diff --git a/public/images/cat08.jpg b/public/images/cat08.jpg new file mode 100644 index 0000000000000000000000000000000000000000..455c76e6086fc2d789b718f71d2a66c9afdc5d95 Binary files /dev/null and b/public/images/cat08.jpg differ diff --git a/public/images/cat09.jpg b/public/images/cat09.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f512e5315736ccc8cfa6741455c2200d441ba326 Binary files /dev/null and b/public/images/cat09.jpg differ diff --git a/public/images/cat10.jpg b/public/images/cat10.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6df427b1900ff44b65a3169dc11dc6ded7bc25c1 Binary files /dev/null and b/public/images/cat10.jpg differ diff --git a/public/images/cat11.jpg b/public/images/cat11.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4cfa2e8749b17ffe2dedbcd3310eceb4162c32a3 Binary files /dev/null and b/public/images/cat11.jpg differ diff --git a/public/images/cat12.jpg b/public/images/cat12.jpg new file mode 100644 index 0000000000000000000000000000000000000000..389b87bbbc6080dfa0c004ab3fe368e0489964d6 Binary files /dev/null and b/public/images/cat12.jpg differ diff --git a/public/images/cat13.jpg b/public/images/cat13.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0354167673171141db46052e4775fad34630a194 Binary files /dev/null and b/public/images/cat13.jpg differ diff --git a/public/images/cat14.jpg b/public/images/cat14.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4727fb562bca6f0be4ddd93d152ba8c62eeb2ba2 Binary files /dev/null and b/public/images/cat14.jpg differ diff --git a/public/images/cat15.jpg b/public/images/cat15.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bbadc1ea532b8d78c9a4d71dc6c5804711421b90 Binary files /dev/null and b/public/images/cat15.jpg differ diff --git a/public/images/fluffy.jpg b/public/images/fluffy.jpg deleted file mode 100644 index 93a33ff4f75e4c532067c12860459a730f9be75f..0000000000000000000000000000000000000000 Binary files a/public/images/fluffy.jpg and /dev/null differ diff --git a/public/images/imagez.png b/public/images/imagez.png new file mode 100644 index 0000000000000000000000000000000000000000..a17d9b5a0331dfce1e4d08e5e819fdf7f6289e3a Binary files /dev/null and b/public/images/imagez.png differ diff --git a/public/images/leo.jpg b/public/images/leo.jpg deleted file mode 100644 index 93a33ff4f75e4c532067c12860459a730f9be75f..0000000000000000000000000000000000000000 Binary files a/public/images/leo.jpg and /dev/null differ diff --git a/public/images/whiskers.jpg b/public/images/whiskers.jpg deleted file mode 100644 index 93a33ff4f75e4c532067c12860459a730f9be75f..0000000000000000000000000000000000000000 Binary files a/public/images/whiskers.jpg and /dev/null differ diff --git a/public/js/cats.js b/public/js/cats.js index cfe580b51cb0fff7342d1d33fb7bdd20e2df6088..a49c6fb807a9dcef834602c9594f3e1514da66e3 100644 --- a/public/js/cats.js +++ b/public/js/cats.js @@ -120,7 +120,7 @@ document.addEventListener("DOMContentLoaded", function () { button.addEventListener("click", function (event) { event.stopPropagation(); event.preventDefault(); - let conf = confirm('Are you sure you want to delete this cat?'); + let conf = confirm('Are you sure you want to delete this cat? This will delete all sightings for the cat too.'); if (!conf) { event.preventDefault(); return; diff --git a/public/sounds/d.jpg b/public/sounds/d.jpg deleted file mode 100644 index 6103960b768bef21bb782ec7c526ff7057277c76..0000000000000000000000000000000000000000 Binary files a/public/sounds/d.jpg and /dev/null differ diff --git a/public/sounds/2JWNMUP-cat-meows.mp3 b/public/sounds/fluffy copy 10.mp3 similarity index 100% rename from public/sounds/2JWNMUP-cat-meows.mp3 rename to public/sounds/fluffy copy 10.mp3 diff --git a/public/sounds/fluffy copy 11.mp3 b/public/sounds/fluffy copy 11.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 11.mp3 differ diff --git a/public/sounds/fluffy copy 12.mp3 b/public/sounds/fluffy copy 12.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 12.mp3 differ diff --git a/public/sounds/fluffy copy 13.mp3 b/public/sounds/fluffy copy 13.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 13.mp3 differ diff --git a/public/sounds/fluffy copy 14.mp3 b/public/sounds/fluffy copy 14.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 14.mp3 differ diff --git a/public/sounds/fluffy copy 15.mp3 b/public/sounds/fluffy copy 15.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 15.mp3 differ diff --git a/public/sounds/fluffy copy 2.mp3 b/public/sounds/fluffy copy 2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 2.mp3 differ diff --git a/public/sounds/fluffy copy 3.mp3 b/public/sounds/fluffy copy 3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 3.mp3 differ diff --git a/public/sounds/fluffy copy 4.mp3 b/public/sounds/fluffy copy 4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 4.mp3 differ diff --git a/public/sounds/fluffy copy 5.mp3 b/public/sounds/fluffy copy 5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 5.mp3 differ diff --git a/public/sounds/fluffy copy 6.mp3 b/public/sounds/fluffy copy 6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 6.mp3 differ diff --git a/public/sounds/fluffy copy 7.mp3 b/public/sounds/fluffy copy 7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 7.mp3 differ diff --git a/public/sounds/fluffy copy 8.mp3 b/public/sounds/fluffy copy 8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 8.mp3 differ diff --git a/public/sounds/fluffy copy 9.mp3 b/public/sounds/fluffy copy 9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy 9.mp3 differ diff --git a/public/sounds/fluffy copy.mp3 b/public/sounds/fluffy copy.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..22cc088f0b9a80a1e6312980dc387da6e77c1908 Binary files /dev/null and b/public/sounds/fluffy copy.mp3 differ diff --git a/public/view/404.php b/public/view/404.php index 1169caffce6327e2dd2b114555f0e36f45979fe7..46708e034519a0bef824574138c9a79f1b91be48 100644 --- a/public/view/404.php +++ b/public/view/404.php @@ -1,12 +1,41 @@ <!DOCTYPE html> <html lang="en"> + <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>Document</title> + <title>404 Error - Page Not Found</title> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="stylesheet" type="text/css" href="../public/css/styles.css"> + + <style> + body { + font-family: Arial, sans-serif; + text-align: center; + } + + h1 { + color: #333; + } + + p { + color: #666; + } + + a { + color: #007bff; + text-decoration: none; + } + </style> </head> + <body> - <h1>404 gan</h1> + <?php require_once(PROJECT_ROOT_PATH . '/public/components/Navbar.php'); ?><br><br><br><br> + <h1>404 Error - Page Not Found</h1> + <p>Sorry, the page you are looking for could not be found. Please check the URL or return to the <a + href="/">homepage</a>.</p> </body> + </html> \ No newline at end of file diff --git a/public/view/cat_specific.php b/public/view/cat_specific.php index 4a0135e342ce6b000efd58ce045de2a7d109779e..bdd4449d4cbf534da2ac1f4c1e9d35af715caa9a 100644 --- a/public/view/cat_specific.php +++ b/public/view/cat_specific.php @@ -7,6 +7,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="../public/css/styles.css"> + <link rel="icon" href="../public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="../public/images/logo.jpeg" type="image/jpeg"> </head> <body> diff --git a/public/view/cats.php b/public/view/cats.php index d7a814ac4f50b5006be791eecd5917d122abcbb8..296b4256e6e6f68f41f08d3192156d478d25e114 100644 --- a/public/view/cats.php +++ b/public/view/cats.php @@ -7,6 +7,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="public/css/styles.css"> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <body> @@ -126,11 +128,11 @@ </div> </div> <audio class="cat-audio" controls> + <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/mp3"> <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/mpeg"> <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/ogg"> <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/wav"> <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/mp4"> - <source src="public/<?= htmlspecialchars($cat['sound_path']) ?>" type="audio/mp3"> </audio> <?php if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']): ?> <!-- Edit and delete buttons for admin users --> diff --git a/public/view/home.php b/public/view/home.php index 5a079e980f62889e0e8eb63e8c14c18321f79bb1..1c250aea6e86024fbdb7bf9d034f74474005a8a5 100644 --- a/public/view/home.php +++ b/public/view/home.php @@ -6,6 +6,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="public/css/styles.css"> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <title>Kuchenk Guide</title> </head> diff --git a/public/view/login.php b/public/view/login.php index caafa53fa28924ef1fc0dc3ed77ab32446478c29..37b37f9af9c4546c1678564adf49e02a93378155 100644 --- a/public/view/login.php +++ b/public/view/login.php @@ -7,6 +7,8 @@ <title>Login</title> <script src="public/js/login.js"></script> <link rel="stylesheet" type="text/css" href="public/css/login.css"> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <body> @@ -23,7 +25,7 @@ <button type="submit" class="login-button">Login</button> </form> <p>Don't have an account?</p> - <a href="/register" class="link">register</a> + <a href="/register" class="link">Register</a> </div> </body> diff --git a/public/view/register.php b/public/view/register.php index 850ff1d88d26586c870e5f800465ca551d1f9b35..75c0678c170d5be0792af23aebb5b05fcd14eeb4 100644 --- a/public/view/register.php +++ b/public/view/register.php @@ -8,10 +8,13 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="public/css/login.css"> <script src="./public/js/register.js"></script> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <body> -<!-- --><?php //require_once(PROJECT_ROOT_PATH . '/public/components/Navbar.php'); ?> + <!-- --> + <?php //require_once(PROJECT_ROOT_PATH . '/public/components/Navbar.php'); ?> <div class="register-container"> <div class="login-logo"> <img src="public/images/logo.jpeg" alt="Your Logo"> @@ -35,13 +38,15 @@ <span id="passwordError" class="error-message"></span><br><br> <label for="confirm-password" id="confirm-passwordLabel" class="register-label">Confirm Password:</label> - <input type="password" id="confirm-password" name="confirm-password" class="register-input" required /><br /><br /> + <input type="password" id="confirm-password" name="confirm-password" class="register-input" + required /><br /><br /> <span id="confPassError" class="error-message"></span><br><br> - <button type="submit" id="registerButton" class="register-button" onclick="register(event)">Register</button> + <button type="submit" id="registerButton" class="register-button" + onclick="register(event)">Register</button> </form> <p>Already have an account?</p> - <a href="/login" class="link">log in</a> + <a href="/login" class="link">Log in</a> </div> </body> diff --git a/public/view/sighting.php b/public/view/sighting.php index 6940b74941eafdcfd760f065771b1e9ebd5a0d5c..8eb19435702c7a3ae3d0a9891c1eba30ba9996dc 100644 --- a/public/view/sighting.php +++ b/public/view/sighting.php @@ -7,6 +7,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="public/css/styles.css"> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <body> diff --git a/public/view/users.php b/public/view/users.php index 691e456e00873c5e6864eb7139654b8b5dadd4c7..f93471e5606c42f6c67b21cc28c2cb0e77982da8 100644 --- a/public/view/users.php +++ b/public/view/users.php @@ -7,6 +7,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="public/css/styles.css"> + <link rel="icon" href="/public/images/logo.jpeg" type="image/jpeg"> + <link rel="shortcut icon" href="/public/images/logo.jpeg" type="image/jpeg"> </head> <body> diff --git a/src/utils/FileUploader.php b/src/utils/FileUploader.php index b1eb57e096107a82d2244b359bd2aab97576d6be..f62e3187840b8df2db2e7fbc812eed294242d89f 100644 --- a/src/utils/FileUploader.php +++ b/src/utils/FileUploader.php @@ -12,7 +12,6 @@ function handleFileUpload($inputName, $uploadDirectory) return $randomID . $uploadedFile['name']; } } - echo "fail"; return null; // Return null if upload fails. } \ No newline at end of file diff --git a/src/utils/Router.php b/src/utils/Router.php index ca80016531bfb5e12a35803fe71bc98263df4bc8..d116525f34bf6a61877e69ffe9ba0ebf41a07f68 100644 --- a/src/utils/Router.php +++ b/src/utils/Router.php @@ -2,58 +2,68 @@ require_once PROJECT_ROOT_PATH . "/src/bases/BaseController.php"; require_once PROJECT_ROOT_PATH . "/src/utils/Middleware.php"; -class Router { - +class Router +{ + private $pathAndHandler; - public function route($path, $handler, $middlewares) { + public function route($path, $handler, $middlewares) + { $this->pathAndHandler[$path] = [$handler, $middlewares]; } - public function run($path, $method) { + public function run($path, $method) + { try { $pathWithoutQuery = explode('?', $path)[0]; $this->routing($pathWithoutQuery, $method); } catch (Exception $e) { - header("HTTP/1.0 500 Internal Server Error"); - echo (new BaseResponse( - false, - null, - $e->getMessage(), - 500 - ))->toJSON(); - } + header("HTTP/1.0 404 Not Found"); + if ($method == "GET") { + require_once PROJECT_ROOT_PATH . "/public/view/404.php"; + } else { + echo ( + new BaseResponse( + false, + null, + $e->getMessage(), + 404 + ) + )->toJSON(); + } + } } - private function routing($path, $method) { + private function routing($path, $method) + { foreach ($this->pathAndHandler as $key => $value) { $match = $this->isMatch($path, $key); if ($match[0]) { $middlewares = $value[1]; if (array_key_exists($method, $middlewares)) { - $value_auth = $middlewares[$method]; // Get the value associated with the method - Middleware::resolve($value_auth); - } + $value_auth = $middlewares[$method]; // Get the value associated with the method + Middleware::resolve($value_auth); + } echo $value[0]->handle($method, $match[1]); - exit(); + exit(); } } - throw new Exception("Method not allowed"); + throw new Exception("Not Found"); } -public function isMatch($path, $keyHandler) { + public function isMatch($path, $keyHandler) + { $regexPattern = str_replace(['/', '*'], ['\/', '([^\/]+)'], $keyHandler); $regexPattern = "/^" . $regexPattern . "$/"; if (preg_match($regexPattern, $path, $matches)) { - array_shift($matches); - return [true, $matches]; + array_shift($matches); + return [true, $matches]; } return [false, []]; -} - -} + } +} \ No newline at end of file