├── num.txt ├── LtGr.png ├── LtOr.png ├── PEHeader.jpg ├── database.db ├── favicon.ico ├── rotary.png ├── admin_users.db ├── ticket_content.txt ├── logout.php ├── remove_all.php ├── fetch_header.php ├── fetch_sponsor_header.php ├── show_header_letter.php ├── db_connection.php ├── information.txt ├── volunteer_signups.sql ├── fetch_images.php ├── fetch_sponsor_images.php ├── fetch_sponsor.php ├── test_footer.php ├── show_images.php ├── remove_redundant.php ├── create_table.php ├── clear_database.php ├── load.php ├── delete_image.php ├── sponsor_edit_image.php ├── delete_header.php ├── delete_sponsor_header.php ├── delete_sponsor_image.php ├── edit_image.php ├── datefooter.php ├── update_sponsor_urls_bulk.php ├── remove_redundant.sql ├── volunteer_signups.php ├── update_schema.php ├── update_caption.php ├── edit_header.php ├── save_header.php ├── update_sponsor_url.php ├── volunteer_slots.php ├── populate_database.php ├── update_role.php ├── save.php ├── populate_ride_visibility.php ├── sponsor_upload_image.php ├── get_signup_data.php ├── backup.php ├── dashboard.php ├── edit_sponsor_header.php ├── upload_image.php ├── update_missing_tables.php ├── populate_database.sql ├── delete_signup.php ├── modify_volunteers_table.php ├── relationship_debug.php ├── update_database.php ├── sponsor_save_header.php ├── footer.php ├── header.php ├── signup_slot.php ├── delete_volunteer.php ├── get_available_shifts.php ├── delete_all_signups.php ├── manage_database.php ├── create_account.php ├── saveRole.php ├── update_signup.php ├── login.php ├── edit_volunteer.php ├── get_valid_shifts.php ├── master.css ├── get_available_groupsizes.php ├── get_available_roles.php ├── role_signup.php ├── faqs.php ├── sponsor_us.php ├── merchandise.php ├── ticket.php ├── signup.php ├── manage_volunteers.php ├── role_selection.php ├── volunteer_portal.php ├── volunteer_login.php ├── setup_event.php ├── volunteer_signup.php ├── contact.php ├── submit_selections.php ├── index.html ├── index.php ├── manage_content.php ├── gallery.php ├── update_signups.php ├── view_role.php ├── sponsors.php └── editor.html /num.txt: -------------------------------------------------------------------------------- 1 | 163 -------------------------------------------------------------------------------- /LtGr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/LtGr.png -------------------------------------------------------------------------------- /LtOr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/LtOr.png -------------------------------------------------------------------------------- /PEHeader.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/PEHeader.jpg -------------------------------------------------------------------------------- /database.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/database.db -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/favicon.ico -------------------------------------------------------------------------------- /rotary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/rotary.png -------------------------------------------------------------------------------- /admin_users.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeMaster0099/polar-express/HEAD/admin_users.db -------------------------------------------------------------------------------- /ticket_content.txt: -------------------------------------------------------------------------------- 1 | {"event_days":"Test<\/span><\/b> day<\/i><\/span><\/span>","first_ride_time":"Test<\/i> ride<\/b>","ticket_prices":"Test price<\/span>","footer":"@2024 Polar express"} -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /remove_all.php: -------------------------------------------------------------------------------- 1 | prepare("DELETE FROM volunteer_signups WHERE signup_id = :signupId"); 7 | $stmt->bindValue(':signupId', $signupId, SQLITE3_INTEGER); 8 | $stmt->execute(); 9 | 10 | ?> 11 | -------------------------------------------------------------------------------- /fetch_header.php: -------------------------------------------------------------------------------- 1 | query($sql); 8 | $headers = []; 9 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 10 | $headers[] = $row; 11 | } 12 | 13 | echo json_encode($headers); 14 | ?> 15 | -------------------------------------------------------------------------------- /fetch_sponsor_header.php: -------------------------------------------------------------------------------- 1 | query($sql); 8 | $headers = []; 9 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 10 | $headers[] = $row; 11 | } 12 | 13 | echo json_encode($headers); 14 | ?> 15 | -------------------------------------------------------------------------------- /show_header_letter.php: -------------------------------------------------------------------------------- 1 | query($sql); 8 | $headers = []; 9 | while ($row = $headerStmt->fetchArray(SQLITE3_ASSOC)) { 10 | $headers[] = $row; 11 | } 12 | echo json_encode($headers); 13 | ?> -------------------------------------------------------------------------------- /db_connection.php: -------------------------------------------------------------------------------- 1 | false, 11 | 'error' => 'Database connection failed' 12 | ]); 13 | exit; 14 | } 15 | -------------------------------------------------------------------------------- /information.txt: -------------------------------------------------------------------------------- 1 | {"event_days":"The Polar Express<\/span><\/b> is brought to you by the Rotary Club<\/b> of White River 39 South Main St., PO Box 4003 - White River Jct., VT 05001","first_ride_time":"Contact Info<\/b>: polarexpress.info@yahoo.com","ticket_prices":"<\/i>* THE POLAR EXPRESS<\/b>: \u2122 & \u00a9 Warner Bros. Entertainment Inc.","footer":"@2024 Polar express"} -------------------------------------------------------------------------------- /volunteer_signups.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS volunteer_signups ( 2 | id INTEGER PRIMARY KEY AUTOINCREMENT, 3 | volunteer_id INTEGER NOT NULL, 4 | slot_id INTEGER NOT NULL, 5 | num_people INTEGER NOT NULL DEFAULT 1, 6 | notes TEXT, 7 | created_at TEXT DEFAULT CURRENT_TIMESTAMP, 8 | FOREIGN KEY (volunteer_id) REFERENCES volunteers (id), 9 | FOREIGN KEY (slot_id) REFERENCES volunteer_slots (id) 10 | ); -------------------------------------------------------------------------------- /fetch_images.php: -------------------------------------------------------------------------------- 1 | query($sql); 10 | $images = []; 11 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 12 | $images[] = $row; 13 | } 14 | 15 | echo json_encode($images); 16 | ?> 17 | -------------------------------------------------------------------------------- /fetch_sponsor_images.php: -------------------------------------------------------------------------------- 1 | query($sql); 10 | $images = []; 11 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 12 | $images[] = $row; 13 | } 14 | 15 | echo json_encode($images); 16 | ?> 17 | -------------------------------------------------------------------------------- /fetch_sponsor.php: -------------------------------------------------------------------------------- 1 | query($sql); 10 | $images = []; 11 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 12 | $images[] = $row; 13 | } 14 | 15 | echo json_encode($images); 16 | ?> 17 | -------------------------------------------------------------------------------- /test_footer.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 5 | $footerResult = $footerStmt->execute(); 6 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 7 | 8 | if ($footerRow && isset($footerRow['content'])) { 9 | echo "

Database Fetch Success: " . htmlspecialchars($footerRow['content']) . "

"; 10 | } else { 11 | echo "

Database Fetch Failed.

"; 12 | } 13 | ?> 14 | -------------------------------------------------------------------------------- /show_images.php: -------------------------------------------------------------------------------- 1 | query($sql); 10 | 11 | $images = []; 12 | while ($row = $imageStmt->fetchArray(SQLITE3_ASSOC)) { 13 | $images[] = $row; 14 | } 15 | 16 | echo json_encode($images); 17 | ?> -------------------------------------------------------------------------------- /remove_redundant.php: -------------------------------------------------------------------------------- 1 | exec("DELETE FROM volunteer_signups"); 7 | $db->exec("DELETE FROM volunteers"); 8 | $db->exec("DELETE FROM volunteer_slots"); 9 | 10 | // Vacuum the database 11 | $db->exec("VACUUM"); 12 | 13 | echo "All volunteer data has been cleared and tables are consistent with the schema."; 14 | } catch (Exception $e) { 15 | echo "Error: " . $e->getMessage(); 16 | } 17 | ?> 18 | -------------------------------------------------------------------------------- /create_table.php: -------------------------------------------------------------------------------- 1 | exec($sql)) { 12 | throw new Exception("SQL Error: " . $db->lastErrorMsg()); 13 | } 14 | 15 | echo "Table 'admin_users' created successfully!"; 16 | $db->close(); 17 | } catch (Exception $e) { 18 | echo "Error: " . $e->getMessage(); 19 | } 20 | ?> 21 | -------------------------------------------------------------------------------- /clear_database.php: -------------------------------------------------------------------------------- 1 | exec($sql); 9 | 10 | if ($result) { 11 | echo json_encode(["status" => "success", "message" => "All volunteer records cleared successfully."]); 12 | } else { 13 | echo json_encode(["status" => "error", "message" => "Failed to clear volunteer records."]); 14 | } 15 | } catch (Exception $e) { 16 | echo json_encode(["status" => "error", "message" => $e->getMessage()]); 17 | } 18 | exit; -------------------------------------------------------------------------------- /load.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :page"); 18 | $stmt->bindValue(':page', $page, SQLITE3_TEXT); 19 | $result = $stmt->execute(); 20 | $row = $result->fetchArray(SQLITE3_ASSOC); 21 | 22 | echo $row['content'] ?? ""; 23 | ?> 24 | -------------------------------------------------------------------------------- /delete_image.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 9 | exit; 10 | } 11 | 12 | $id = $data['id']; 13 | // 14 | $sql = "DELETE FROM file_uploads WHERE id = :id"; 15 | $stmt = $db->prepare($sql); 16 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 17 | 18 | if ($stmt->execute()) { 19 | echo json_encode(["status" => "success", "message" => "Image deleted successfully"]); 20 | } else { 21 | echo json_encode(["status" => "error", "message" => "Failed to delete image"]); 22 | } 23 | ?> -------------------------------------------------------------------------------- /sponsor_edit_image.php: -------------------------------------------------------------------------------- 1 | prepare("UPDATE sponsor_file_uploads SET header_id = :header_id WHERE id = :id"); 13 | $stmt->bindValue(':header_id', $header_id, SQLITE3_INTEGER); 14 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 15 | $stmt->execute(); 16 | 17 | echo json_encode(["status" => "success"]); 18 | } else { 19 | echo json_encode(["status" => "error"]); 20 | } 21 | ?> -------------------------------------------------------------------------------- /delete_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 9 | exit; 10 | } 11 | 12 | $id = $data['id']; 13 | 14 | $sql = "DELETE FROM header_table WHERE id = :id"; 15 | $stmt = $db->prepare($sql); 16 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 17 | 18 | if ($stmt->execute()) { 19 | echo json_encode(["status" => "success", "message" => "Header deleted successfully"]); 20 | } else { 21 | echo json_encode(["status" => "error", "message" => "Failed to delete header"]); 22 | } 23 | 24 | ?> -------------------------------------------------------------------------------- /delete_sponsor_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 9 | exit; 10 | } 11 | 12 | $id = $data['id']; 13 | $sql = "DELETE FROM sponsor_header_table WHERE id = :id"; 14 | $stmt = $db->prepare($sql); 15 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 16 | 17 | if ($stmt->execute()) { 18 | echo json_encode(["status" => "success", "message" => "Header deleted successfully"]); 19 | } else { 20 | echo json_encode(["status" => "error", "message" => "Failed to delete header"]); 21 | } 22 | -------------------------------------------------------------------------------- /delete_sponsor_image.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 9 | exit; 10 | } 11 | 12 | $id = $data['id']; 13 | 14 | $sql = "DELETE FROM sponsor_file_uploads WHERE id = :id"; 15 | $stmt = $db->prepare($sql); 16 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 17 | 18 | if ($stmt->execute()) { 19 | echo json_encode(["status" => "success", "message" => "Image deleted successfully"]); 20 | } else { 21 | echo json_encode(["status" => "error", "message" => "Failed to delete image"]); 22 | } 23 | 24 | ?> -------------------------------------------------------------------------------- /edit_image.php: -------------------------------------------------------------------------------- 1 | prepare("UPDATE file_uploads SET caption = :caption, header_id = :header_id WHERE id = :id"); 14 | $stmt->bindValue(':caption', $caption, SQLITE3_TEXT); 15 | $stmt->bindValue(':header_id', $header_id, SQLITE3_INTEGER); 16 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 17 | $stmt->execute(); 18 | 19 | echo json_encode(["status" => "success"]); 20 | } else { 21 | echo json_encode(["status" => "error"]); 22 | } 23 | ?> -------------------------------------------------------------------------------- /datefooter.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 11 | $result = $stmt->execute(); 12 | $row = $result->fetchArray(SQLITE3_ASSOC); 13 | $footer_content = $row['content'] ?? "© 2024 Polar Express"; 14 | ?> 15 | 16 | 17 |
18 |

19 |
20 | -------------------------------------------------------------------------------- /update_sponsor_urls_bulk.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid data"]); 9 | exit; 10 | } 11 | 12 | foreach ($data['urls'] as $update) { 13 | if (!isset($update['id']) || !isset($update['url'])) { 14 | continue; 15 | } 16 | 17 | $id = intval($update['id']); 18 | $url = trim($update['url']); 19 | 20 | $stmt = $db->prepare("UPDATE sponsor_file_uploads SET url = ? WHERE id = ?"); 21 | $stmt->bindValue(1, $url, SQLITE3_TEXT); 22 | $stmt->bindValue(2, $id, SQLITE3_INTEGER); 23 | $stmt->execute(); 24 | } 25 | 26 | echo json_encode(["status" => "success"]); 27 | ?> -------------------------------------------------------------------------------- /remove_redundant.sql: -------------------------------------------------------------------------------- 1 | -- Step 1: Create a new table without redundant columns 2 | CREATE TABLE new_volunteers ( 3 | id INTEGER PRIMARY KEY AUTOINCREMENT, 4 | name TEXT NOT NULL, 5 | email TEXT NOT NULL UNIQUE, 6 | phone TEXT, 7 | password TEXT, 8 | created_at TEXT DEFAULT CURRENT_TIMESTAMP, 9 | num_people INTEGER DEFAULT 1 -- Retain this if necessary for general group tracking 10 | ); 11 | 12 | -- Step 2: Copy data from the old table to the new table 13 | INSERT INTO new_volunteers (id, name, email, phone, password, created_at, num_people) 14 | SELECT id, name, email, phone, password, created_at, num_people 15 | FROM volunteers; 16 | 17 | -- Step 3: Drop the old table 18 | DROP TABLE volunteers; 19 | 20 | -- Step 4: Rename the new table to volunteers 21 | ALTER TABLE new_volunteers RENAME TO volunteers; 22 | -------------------------------------------------------------------------------- /volunteer_signups.php: -------------------------------------------------------------------------------- 1 | exec($query); 22 | echo "Table 'volunteer_signups' created successfully."; 23 | } catch (Exception $e) { 24 | echo "Error: " . $e->getMessage(); 25 | } 26 | ?> 27 | -------------------------------------------------------------------------------- /update_schema.php: -------------------------------------------------------------------------------- 1 | exec($command)) { 21 | throw new Exception("SQL Error: " . $db->lastErrorMsg()); 22 | } 23 | } 24 | } 25 | 26 | echo "Database updated successfully!"; 27 | $db->close(); 28 | } catch (Exception $e) { 29 | echo "Error: " . $e->getMessage(); 30 | } 31 | ?> 32 | -------------------------------------------------------------------------------- /update_caption.php: -------------------------------------------------------------------------------- 1 | prepare("UPDATE file_uploads SET caption = :caption WHERE id = :id"); 13 | 14 | $stmt->bindValue(':caption', $caption); 15 | $stmt->bindValue(':id', $id); 16 | $result = $stmt->execute(); 17 | 18 | 19 | if ($result) { 20 | echo json_encode(["status" => "success"]); 21 | } else { 22 | echo json_encode(["status" => "error", "message" => "Failed to update."]); 23 | } 24 | 25 | $stmt->close(); 26 | } else { 27 | echo json_encode(["status" => "error", "message" => "Invalid data."]); 28 | } 29 | ?> -------------------------------------------------------------------------------- /edit_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 10 | exit; 11 | } 12 | 13 | $id = $data['id']; 14 | $header_text = $data['header_text']; 15 | $sub_text = $data['sub_text']; 16 | 17 | $sql = "UPDATE header_table SET header_text = :header_text, sub_text = :sub_text WHERE id = :id"; 18 | $stmt = $db->prepare($sql); 19 | $stmt->bindValue(':header_text', $header_text, SQLITE3_TEXT); 20 | $stmt->bindValue(':sub_text', $sub_text, SQLITE3_TEXT); 21 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 22 | 23 | if ($stmt->execute()) { 24 | echo json_encode(["status" => "success", "message" => "Header updated successfully"]); 25 | } else { 26 | echo json_encode(["status" => "error", "message" => "Failed to update header"]); 27 | } 28 | 29 | 30 | 31 | 32 | ?> -------------------------------------------------------------------------------- /save_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 8 | exit; 9 | } 10 | 11 | $header = $data['header']; 12 | $sub = $data['sub']; 13 | 14 | if (empty($header)) { 15 | echo json_encode(["status" => "error", "message" => "Header cannot be empty"]); 16 | exit; 17 | } 18 | 19 | // Insert data into header_table 20 | $sql = "INSERT INTO header_table (header_text, sub_text) VALUES (:header, :sub)"; 21 | $stmt = $db->prepare($sql); 22 | $stmt->bindValue(':header', $header, SQLITE3_TEXT); 23 | $stmt->bindValue(':sub',$sub, SQLITE3_TEXT); 24 | 25 | 26 | if ($stmt->execute()) { 27 | echo json_encode(["status" => "success", "message" => "success"]); 28 | } else { 29 | echo json_encode(["status" => "error", "message" => "Database error"]); 30 | } 31 | 32 | $stmt->close(); 33 | $db->close(); 34 | ?> -------------------------------------------------------------------------------- /update_sponsor_url.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid data received", "received" => $data]); 17 | exit; 18 | } 19 | 20 | $id = intval($data['id']); 21 | $url = trim($data['url']); 22 | 23 | $stmt = $db->prepare("UPDATE sponsor_file_uploads SET url = ? WHERE id = ?"); 24 | $stmt->bindValue(1, $url, SQLITE3_TEXT); 25 | $stmt->bindValue(2, $id, SQLITE3_INTEGER); 26 | 27 | if ($stmt->execute()) { 28 | echo json_encode(["status" => "success"]); 29 | } else { 30 | echo json_encode(["status" => "error"]); 31 | } 32 | ?> 33 | -------------------------------------------------------------------------------- /volunteer_slots.php: -------------------------------------------------------------------------------- 1 | query($query); 11 | 12 | echo "

Volunteer Slots for Conductors

"; 13 | echo ""; 14 | echo ""; 15 | 16 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 17 | echo ""; 18 | echo ""; 19 | echo ""; 20 | echo ""; 21 | echo ""; 22 | echo ""; 23 | } 24 | 25 | echo "
Slot IDCategoryRide IDMax Volunteers
" . htmlspecialchars($row['slot_id']) . "" . htmlspecialchars($row['category']) . "" . htmlspecialchars($row['ride_id']) . "" . htmlspecialchars($row['max_volunteers']) . "
"; 26 | 27 | $db->close(); 28 | } catch (Exception $e) { 29 | echo "Error: " . $e->getMessage(); 30 | } 31 | ?> 32 | -------------------------------------------------------------------------------- /populate_database.php: -------------------------------------------------------------------------------- 1 | exec($command)) { 22 | throw new Exception("SQL Error: " . $db->lastErrorMsg()); 23 | } 24 | } 25 | } 26 | 27 | echo "Database populated successfully!"; 28 | $db->close(); 29 | } catch (Exception $e) { 30 | echo "Error: " . $e->getMessage(); 31 | } 32 | ?> 33 | -------------------------------------------------------------------------------- /update_role.php: -------------------------------------------------------------------------------- 1 | prepare($sql); 15 | $stmt->execute([$max_volunteers, $slot_id]); 16 | 17 | $sql = "UPDATE shift_availability_cache 18 | SET remaining_spots = ?, if_full = CASE WHEN ? = 0 THEN 1 ELSE if_full END 19 | WHERE shift_id = ? AND role_id = ? AND remaining_spots != 0 AND if_full != 1"; 20 | $stmt = $db->prepare($sql); 21 | $stmt->execute([$remaining_slots, $remaining_slots, $slot_id, $role_id]); 22 | 23 | $stmt->close(); 24 | $db->close(); 25 | 26 | } catch (Exception $e) { 27 | echo json_encode([ 28 | 'success' => false, 29 | 'message' => $e->getMessage() 30 | ]); 31 | } 32 | -------------------------------------------------------------------------------- /save.php: -------------------------------------------------------------------------------- 1 | exec("CREATE TABLE IF NOT EXISTS page_content ( 16 | id INTEGER PRIMARY KEY AUTOINCREMENT, 17 | page_name TEXT UNIQUE NOT NULL, 18 | content TEXT NOT NULL 19 | )"); 20 | 21 | // Insert or update content 22 | $stmt = $db->prepare("INSERT INTO page_content (page_name, content) VALUES (:page, :content) 23 | ON CONFLICT(page_name) DO UPDATE SET content = excluded.content"); 24 | $stmt->bindValue(':page', $page, SQLITE3_TEXT); 25 | $stmt->bindValue(':content', $content, SQLITE3_TEXT); 26 | 27 | if ($stmt->execute()) { 28 | echo "success"; 29 | } else { 30 | echo "Error saving content."; 31 | } 32 | } else { 33 | echo "Invalid request."; 34 | } 35 | ?> 36 | -------------------------------------------------------------------------------- /populate_ride_visibility.php: -------------------------------------------------------------------------------- 1 | exec(" 6 | INSERT INTO ride_visibility (ride_id, role_id, visible) VALUES 7 | (1, 1, 1), -- Jolly People, Ride 1 8 | (1, 2, 1), -- Elves, Ride 1 9 | (1, 3, 1), -- Chefs, Ride 1 10 | (1, 4, 1), -- Conductors, Ride 1 11 | (2, 1, 1), -- Jolly People, Ride 2 12 | (2, 2, 1), -- Elves, Ride 2 13 | (2, 3, 1), -- Chefs, Ride 2 14 | (2, 4, 1), -- Conductors, Ride 2 15 | (3, 1, 1), -- Jolly People, Ride 3 16 | (3, 2, 1), -- Elves, Ride 3 17 | (3, 3, 1), -- Chefs, Ride 3 18 | (3, 4, 1), -- Conductors, Ride 3 19 | (4, 1, 1), -- Jolly People, Ride 4 20 | (4, 2, 1), -- Elves, Ride 4 21 | (4, 3, 1), -- Chefs, Ride 4 22 | (4, 4, 1), -- Conductors, Ride 4 23 | (5, 1, 1), -- Jolly People, Ride 5 24 | (5, 2, 1), -- Elves, Ride 5 25 | (5, 3, 1), -- Chefs, Ride 5 26 | (5, 4, 1), -- Conductors, Ride 5 27 | "); 28 | 29 | echo "Ride visibility populated successfully!"; 30 | $db->close(); 31 | } catch (Exception $e) { 32 | echo "Error: " . $e->getMessage(); 33 | } 34 | ?> 35 | -------------------------------------------------------------------------------- /sponsor_upload_image.php: -------------------------------------------------------------------------------- 1 | prepare("INSERT INTO sponsor_file_uploads (header_id, path) VALUES (:header_id, :path)"); 21 | $stmt->bindValue(':header_id', $headerId, SQLITE3_INTEGER); 22 | $stmt->bindValue(':path', $targetPath, SQLITE3_TEXT); 23 | $stmt->execute(); 24 | 25 | echo json_encode(["status" => "success", "path" => $targetPath]); 26 | } else { 27 | echo json_encode(["status" => "error", "message" => "File upload failed"]); 28 | } 29 | } else { 30 | echo json_encode(["status" => "error", "message" => "No file uploaded"]); 31 | } 32 | } 33 | 34 | ?> 35 | 36 | -------------------------------------------------------------------------------- /get_signup_data.php: -------------------------------------------------------------------------------- 1 | prepare($volunteer_query); 13 | $stmt->execute([$signup_id, $role_id]); 14 | $existing_signup = $stmt->fetch(PDO::FETCH_ASSOC); 15 | 16 | // Get all available shifts 17 | $shift_query = "SELECT s.shift_id, s.shift_name, COALESCE(sg.volunteer_size, 0) as volunteer_size 18 | FROM shifts s 19 | LEFT JOIN signups sg ON s.shift_id = sg.shift_id 20 | AND sg.signup_id = ? 21 | WHERE s.date = ? 22 | ORDER BY s.shift_name"; 23 | $stmt = $pdo->prepare($shift_query); 24 | $stmt->execute([$signup_id, $current_date]); 25 | $shifts = $stmt->fetchAll(PDO::FETCH_ASSOC); 26 | 27 | // Prepare response 28 | $response = [ 29 | 'current_shift_id' => $existing_signup ? $existing_signup['shift_id'] : null, 30 | 'shifts' => $shifts 31 | ]; 32 | 33 | header('Content-Type: application/json'); 34 | echo json_encode($response); 35 | ?> -------------------------------------------------------------------------------- /backup.php: -------------------------------------------------------------------------------- 1 | exec($query); 35 | } 36 | 37 | $db->close(); 38 | exit; 39 | } else { 40 | echo "Backup failed!"; 41 | } 42 | -------------------------------------------------------------------------------- /dashboard.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Admin Dashboard 8 | 9 | 10 |
11 |

Admin Dashboard

12 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /edit_sponsor_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 10 | exit; 11 | } 12 | 13 | $id = $data['id']; 14 | $header_text = $data['header_text']; 15 | $sub_text = $data['sub_text']; 16 | 17 | // 🔴 Debugging: Log received data 18 | file_put_contents('debug.log', "Received Edit Request - ID: $id, Header: $header_text, Subtext: $sub_text\n", FILE_APPEND); 19 | 20 | $sql = "UPDATE sponsor_header_table SET header_text = :header_text, sub_text = :sub_text WHERE id = :id"; 21 | $stmt = $db->prepare($sql); 22 | $stmt->bindValue(':header_text', $header_text, SQLITE3_TEXT); 23 | $stmt->bindValue(':sub_text', $sub_text, SQLITE3_TEXT); 24 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 25 | 26 | if ($stmt->execute()) { 27 | file_put_contents('debug.log', "✅ Update Successful!\n", FILE_APPEND); 28 | echo json_encode(["status" => "success", "message" => "Header updated successfully"]); 29 | } else { 30 | file_put_contents('debug.log', "❌ Update Failed!\n", FILE_APPEND); 31 | echo json_encode(["status" => "error", "message" => "Failed to update header"]); 32 | } 33 | ?> 34 | -------------------------------------------------------------------------------- /upload_image.php: -------------------------------------------------------------------------------- 1 | prepare("INSERT INTO file_uploads (header_id, caption, path) VALUES (:header_id, :caption, :path)"); 22 | $stmt->bindValue(':header_id', $headerId, SQLITE3_INTEGER); 23 | $stmt->bindValue(':caption', $caption, SQLITE3_TEXT); 24 | $stmt->bindValue(':path', $targetPath, SQLITE3_TEXT); 25 | $stmt->execute(); 26 | 27 | echo json_encode(["status" => "success", "path" => $targetPath]); 28 | } else { 29 | echo json_encode(["status" => "error", "message" => "File upload failed"]); 30 | } 31 | } else { 32 | echo json_encode(["status" => "error", "message" => "No file uploaded"]); 33 | } 34 | } 35 | 36 | ?> 37 | 38 | -------------------------------------------------------------------------------- /update_missing_tables.php: -------------------------------------------------------------------------------- 1 | exec(" 8 | CREATE TABLE IF NOT EXISTS volunteer_roles ( 9 | id INTEGER PRIMARY KEY AUTOINCREMENT, 10 | role_name TEXT NOT NULL, 11 | visible INTEGER NOT NULL DEFAULT 1 12 | ); 13 | "); 14 | 15 | // Add the ride_visibility table if it doesn't exist 16 | $db->exec(" 17 | CREATE TABLE IF NOT EXISTS ride_visibility ( 18 | id INTEGER PRIMARY KEY AUTOINCREMENT, 19 | ride_id INTEGER NOT NULL, 20 | role_id INTEGER NOT NULL, 21 | visible INTEGER NOT NULL DEFAULT 1, 22 | FOREIGN KEY (ride_id) REFERENCES rides (id), 23 | FOREIGN KEY (role_id) REFERENCES volunteer_roles (id) 24 | ); 25 | "); 26 | 27 | // Add the users table if it doesn't exist 28 | $db->exec(" 29 | CREATE TABLE IF NOT EXISTS users ( 30 | id INTEGER PRIMARY KEY AUTOINCREMENT, 31 | name TEXT NOT NULL, 32 | email TEXT UNIQUE NOT NULL, 33 | password TEXT NOT NULL, 34 | phone TEXT 35 | ); 36 | "); 37 | 38 | echo "Missing tables added successfully!"; 39 | } catch (Exception $e) { 40 | echo "Error: " . $e->getMessage(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /populate_database.sql: -------------------------------------------------------------------------------- 1 | -- Populate rides table 2 | INSERT INTO rides (day, time) VALUES 3 | ('Saturday', '9:30 AM'), 4 | ('Saturday', '11:00 AM'), 5 | ('Saturday', '12:30 PM'), 6 | ('Saturday', '2:00 PM'), 7 | ('Sunday', '9:30 AM'), 8 | ('Sunday', '11:00 AM'), 9 | ('Sunday', '12:30 PM'); 10 | 11 | -- Populate volunteer roles table 12 | INSERT INTO volunteer_roles (role_name) VALUES 13 | ('Jolly People'), 14 | ('Elves'), 15 | ('Chefs'), 16 | ('Conductors'); 17 | 18 | -- Populate volunteer slots table 19 | INSERT INTO volunteer_slots (ride_id, role_id, max_volunteers) VALUES 20 | (1, 1, 8), -- Jolly People for Ride 1 21 | (1, 2, 12), -- Elves for Ride 1 22 | (1, 3, 6), -- Chefs for Ride 1 23 | (1, 4, 3), -- Conductors for Ride 1, 24 | (2, 1, 8), -- Jolly People for Ride 2 25 | (2, 2, 12), -- Elves for Ride 2 26 | (2, 3, 6), -- Chefs for Ride 2 27 | (2, 4, 3); -- Conductors for Ride 2 28 | 29 | -- Populate ride visibility table 30 | INSERT INTO ride_visibility (ride_id, role_id, visible) VALUES 31 | (1, 1, 1), 32 | (1, 2, 1), 33 | (1, 3, 1), 34 | (1, 4, 1), 35 | (2, 1, 1), 36 | (2, 2, 1), 37 | (2, 3, 1), 38 | (2, 4, 1); 39 | 40 | -- Populate volunteer signups table with sample data 41 | INSERT INTO volunteer_signups (slot_id, name, email, phone, num_people, notes) VALUES 42 | (1, 'John Doe', 'john.doe@example.com', '123-456-7890', 1, 'Looking forward to helping!'), 43 | (2, 'Jane Smith', 'jane.smith@example.com', NULL, 2, 'Excited for the event!'); 44 | -------------------------------------------------------------------------------- /delete_signup.php: -------------------------------------------------------------------------------- 1 | prepare(" 12 | UPDATE shift_availability_cache 13 | SET 14 | remaining_spots = remaining_spots + ( 15 | SELECT num_people FROM volunteer_signups WHERE id = :signupId 16 | ), 17 | is_full = CASE 18 | WHEN remaining_spots + ( 19 | SELECT num_people FROM volunteer_signups WHERE id = :signupId 20 | ) > 0 THEN 0 21 | ELSE is_full 22 | END 23 | WHERE shift_id = ( 24 | SELECT slot_id FROM volunteer_signups WHERE id = :signupId 25 | ); 26 | "); 27 | $stmt->bindValue(':signupId', $signupId, SQLITE3_INTEGER); 28 | $result = $stmt->execute(); 29 | 30 | $stmt = $db->prepare("DELETE FROM volunteer_signups WHERE id = :signupId"); 31 | $stmt->bindValue(':signupId', $signupId, SQLITE3_INTEGER); 32 | if ($stmt->execute()) { 33 | echo json_encode(['success' => true]); 34 | } else { 35 | echo json_encode(['success' => false, 'message' => 'Failed to delete signup.']); 36 | } 37 | 38 | } else { 39 | echo json_encode(['success' => false, 'message' => 'Invalid signup ID.']); 40 | } 41 | -------------------------------------------------------------------------------- /modify_volunteers_table.php: -------------------------------------------------------------------------------- 1 | exec('BEGIN TRANSACTION'); 9 | 10 | // Create a new volunteers table without the unnecessary columns 11 | $db->exec(" 12 | CREATE TABLE volunteers_new ( 13 | id INTEGER PRIMARY KEY AUTOINCREMENT, 14 | name TEXT NOT NULL, 15 | email TEXT NOT NULL UNIQUE, 16 | phone TEXT, 17 | password TEXT NOT NULL, 18 | created_at TEXT DEFAULT CURRENT_TIMESTAMP 19 | ) 20 | "); 21 | 22 | // Transfer data from the old table to the new table 23 | $db->exec(" 24 | INSERT INTO volunteers_new (id, name, email, phone, password, created_at) 25 | SELECT id, name, email, phone, password, created_at 26 | FROM volunteers 27 | "); 28 | 29 | // Drop the old table 30 | $db->exec("DROP TABLE volunteers"); 31 | 32 | // Rename the new table to the original table name 33 | $db->exec("ALTER TABLE volunteers_new RENAME TO volunteers"); 34 | 35 | // Commit the transaction 36 | $db->exec('COMMIT'); 37 | 38 | echo "Schema modification completed successfully.\n"; 39 | } catch (Exception $e) { 40 | // Rollback on error 41 | $db->exec('ROLLBACK'); 42 | echo "Error: " . $e->getMessage(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /relationship_debug.php: -------------------------------------------------------------------------------- 1 | query($query); 13 | 14 | echo "

Relationship Debugging

"; 15 | echo ""; 16 | echo ""; 17 | 18 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 19 | echo ""; 20 | echo ""; 21 | echo ""; 22 | echo ""; 23 | echo ""; 24 | echo ""; 25 | echo ""; 26 | echo ""; 27 | echo ""; 28 | } 29 | 30 | echo "
Slot IDCategoryRide IDRole IDDayTimeVisible
" . htmlspecialchars($row['slot_id']) . "" . htmlspecialchars($row['category']) . "" . htmlspecialchars($row['ride_id']) . "" . htmlspecialchars($row['role_id']) . "" . htmlspecialchars($row['day']) . "" . htmlspecialchars($row['time']) . "" . htmlspecialchars($row['visible']) . "
"; 31 | 32 | $db->close(); 33 | } catch (Exception $e) { 34 | echo "Error: " . $e->getMessage(); 35 | } 36 | ?> 37 | -------------------------------------------------------------------------------- /update_database.php: -------------------------------------------------------------------------------- 1 | exec(" 8 | CREATE TABLE IF NOT EXISTS rides ( 9 | id INTEGER PRIMARY KEY AUTOINCREMENT, 10 | day TEXT NOT NULL, 11 | time TEXT NOT NULL 12 | ); 13 | 14 | CREATE TABLE IF NOT EXISTS volunteer_slots ( 15 | id INTEGER PRIMARY KEY AUTOINCREMENT, 16 | ride_id INTEGER NOT NULL, 17 | category TEXT NOT NULL, 18 | max_volunteers INTEGER NOT NULL, 19 | FOREIGN KEY (ride_id) REFERENCES rides (id) 20 | ); 21 | "); 22 | 23 | // Seed default data 24 | $db->exec(" 25 | INSERT INTO rides (day, time) VALUES 26 | ('Saturday', '09:30 AM'), 27 | ('Saturday', '11:00 AM'), 28 | ('Saturday', '12:30 PM'), 29 | ('Sunday', '09:30 AM'), 30 | ('Sunday', '11:00 AM'); 31 | "); 32 | 33 | $db->exec(" 34 | INSERT INTO volunteer_slots (ride_id, category, max_volunteers) VALUES 35 | (1, 'Jolly People', 8), 36 | (1, 'Elves', 12), 37 | (1, 'Chefs', 6), 38 | (1, 'Conductors', 3), 39 | (2, 'Jolly People', 8), 40 | (2, 'Elves', 12); 41 | "); 42 | 43 | echo "Database updated successfully!"; 44 | } catch (Exception $e) { 45 | echo "Error: " . $e->getMessage(); 46 | } 47 | ?> 48 | -------------------------------------------------------------------------------- /sponsor_save_header.php: -------------------------------------------------------------------------------- 1 | "error", "message" => "Invalid input"]); 8 | exit; 9 | } 10 | 11 | $header = $data['header']; 12 | $sub = $data['sub']; 13 | 14 | if (empty($header)) { 15 | echo json_encode(["status" => "error", "message" => "Header cannot be empty"]); 16 | exit; 17 | } 18 | 19 | // Insert data into header_table 20 | 21 | try{ 22 | $sqlCheck = "SELECT COUNT(*) as count FROM sponsor_header_table"; 23 | $result = $db->querySingle($sqlCheck, true); 24 | 25 | if ($result['count'] > 0) { 26 | echo json_encode(["status" => "error", "message" => "Sponsor have only one header"]); 27 | exit; 28 | } 29 | // Insert data if no row exists 30 | $sql = "INSERT INTO sponsor_header_table (header_text, sub_text) VALUES (:header, :sub)"; 31 | $stmt = $db->prepare($sql); 32 | $stmt->bindValue(':header', $header, SQLITE3_TEXT); 33 | $stmt->bindValue(':sub', $sub, SQLITE3_TEXT); 34 | 35 | if ($stmt->execute()) { 36 | echo json_encode(["status" => "success", "message" => "success"]); 37 | } else { 38 | echo json_encode(["status" => "error", "message" => "Database error"]); 39 | } 40 | 41 | }catch (Exception $e){ 42 | echo json_encode(["status" => "error", "message" => $e->getMessage()]); 43 | } 44 | exit; 45 | 46 | $stmt->close(); 47 | $db->close(); 48 | ?> -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 'No days available.', 7 | 'first_ride_time' => 'No time available.', 8 | 'ticket_prices' => 'No prices available.', 9 | 'footer' => 'No footer', 10 | ]; 11 | ?> 12 | 13 | 14 | -------------------------------------------------------------------------------- /header.php: -------------------------------------------------------------------------------- 1 |
2 | 16 |
-------------------------------------------------------------------------------- /signup_slot.php: -------------------------------------------------------------------------------- 1 | prepare($query); 32 | $stmt->bindValue(':slot_id', $slot_id, SQLITE3_INTEGER); 33 | $slot = $stmt->execute()->fetchArray(SQLITE3_ASSOC); 34 | 35 | if (!$slot) { 36 | echo "Error: Slot not found."; 37 | exit; 38 | } 39 | 40 | // Calculate availability 41 | $available = $slot['max_volunteers'] - $slot['filled_volunteers']; 42 | if ($available <= 0) { 43 | echo "Error: Slot is full."; 44 | exit; 45 | } 46 | 47 | // Insert signup into the database 48 | $insertQuery = " 49 | INSERT INTO volunteer_signups (ride_id, slot_id, user_id, num_people, notes) 50 | VALUES ((SELECT ride_id FROM volunteer_slots WHERE id = :slot_id), :slot_id, :user_id, 1, '') 51 | "; 52 | $stmt = $db->prepare($insertQuery); 53 | $stmt->bindValue(':slot_id', $slot_id, SQLITE3_INTEGER); 54 | $stmt->bindValue(':user_id', $user_id, SQLITE3_INTEGER); 55 | $stmt->execute(); 56 | 57 | echo "Successfully signed up for the slot!"; 58 | $db->close(); 59 | } catch (Exception $e) { 60 | echo "Error: " . $e->getMessage(); 61 | } 62 | ?> 63 | -------------------------------------------------------------------------------- /delete_volunteer.php: -------------------------------------------------------------------------------- 1 | prepare($deleteQuery); 23 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 24 | $stmt->execute(); 25 | 26 | header('Location: manage_volunteers.php?message=deleted'); 27 | exit; 28 | } 29 | 30 | // Fetch the record for confirmation 31 | $id = intval($_GET['id']); 32 | $query = "SELECT * FROM volunteer_slots WHERE id = :id"; 33 | $stmt = $db->prepare($query); 34 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 35 | $record = $stmt->execute()->fetchArray(SQLITE3_ASSOC); 36 | 37 | // Close the database connection 38 | $db->close(); 39 | ?> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Delete Volunteer Slot 48 | 49 | 50 |
51 |

Confirm Deletion

52 |

Are you sure you want to delete the following record?

53 |
    54 |
  • Category:
  • 55 |
  • Max Volunteers:
  • 56 |
57 |
58 | 59 | 60 | Cancel 61 |
62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /get_available_shifts.php: -------------------------------------------------------------------------------- 1 | prepare(" 40 | SELECT shift_id, role_id, remaining_spots 41 | FROM shift_availability_cache 42 | WHERE role_id = :roleId 43 | "); 44 | 45 | // Bind parameters correctly 46 | $stmt->bindValue(':rideId', $rideId, SQLITE3_TEXT); 47 | $stmt->bindValue(':roleId', $roleId, SQLITE3_TEXT); 48 | 49 | // Execute query 50 | $result = $stmt->execute(); 51 | if (!$result) { 52 | throw new Exception("Database query failed"); 53 | } 54 | 55 | // Fetch results 56 | $arrays = []; 57 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 58 | $arrays[] = $row; 59 | } 60 | 61 | echo json_encode([ 62 | 'success' => !empty($arrays), 63 | 'data' => $arrays, 64 | 'message' => empty($arrays) ? 'No data found' : 'Data retrieved successfully' 65 | ]); 66 | } catch (Exception $e) { 67 | // Return error response 68 | echo json_encode([ 69 | 'success' => false, 70 | 'error' => $e->getMessage() 71 | ]); 72 | } 73 | 74 | // Close database connection 75 | $db->close(); 76 | -------------------------------------------------------------------------------- /delete_all_signups.php: -------------------------------------------------------------------------------- 1 | exec('BEGIN TRANSACTION'); 8 | 9 | // Add error checking for empty or invalid data 10 | if (!isset($data['originalValues']) || !is_array($data['originalValues'])) { 11 | throw new Exception('Invalid or missing originalValues data'); 12 | } 13 | 14 | foreach ($data['originalValues'] as $deleteValue) { 15 | // Add validation for requir field 16 | if (!isset($deleteValue['shift']) || !isset($deleteValue['groupSize']) || !isset($deleteValue['role'])) { 17 | throw new Exception('Missing required fields in delete values'); 18 | } 19 | $shiftId = intval($deleteValue['shift']); 20 | $numPeople = intval($deleteValue['groupSize']); 21 | $roleId = intval($deleteValue['role']); 22 | $signupId = intval($data['signupId']); 23 | 24 | $updateQuery = "UPDATE shift_availability_cache 25 | SET remaining_spots = remaining_spots + :numPeople, 26 | is_full = CASE 27 | WHEN remaining_spots + :numPeople > 0 THEN 0 28 | ELSE is_full 29 | END 30 | WHERE shift_id = :shiftId AND role_id = :roleId"; 31 | 32 | $stmt = $db->prepare($updateQuery); 33 | $stmt->bindValue(':numPeople', $numPeople, SQLITE3_INTEGER); 34 | $stmt->bindValue(':shiftId', $shiftId, SQLITE3_INTEGER); 35 | $stmt->bindValue(':roleId', $roleId, SQLITE3_INTEGER); 36 | $result = $stmt->execute(); 37 | 38 | // Delete from volunteer_signups 39 | $deleteQuery = "DELETE FROM volunteer_signups WHERE volunteer_id = :signupId AND slot_id = :shiftId"; 40 | $stmt = $db->prepare($deleteQuery); 41 | $stmt->bindValue(':signupId', $signupId, SQLITE3_INTEGER); 42 | $stmt->bindValue(':shiftId', $shiftId, SQLITE3_INTEGER); 43 | $result = $stmt->execute(); 44 | } 45 | 46 | $db->exec('COMMIT'); 47 | echo json_encode(['success' => true, 'message' => 'Successfully deleted all signups']); 48 | 49 | } catch (Exception $e) { 50 | $db->exec('ROLLBACK'); 51 | error_log($e->getMessage()); // Log the error server-side 52 | echo json_encode(['success' => false, 'message' => 'Failed to delete all signups: ' . $e->getMessage()]); 53 | exit; 54 | } 55 | -------------------------------------------------------------------------------- /manage_database.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Admin Dashboard 9 | 27 | 28 | 29 | 30 |
31 |

Database

32 |
33 |
34 | 35 |
36 |
37 | 38 |
39 |
40 | 41 |
42 |
43 | Back to Dashboard 44 | 45 |
46 | 47 | 65 | 66 | -------------------------------------------------------------------------------- /create_account.php: -------------------------------------------------------------------------------- 1 | prepare("INSERT INTO admin_users (username, password) VALUES (:username, :password)"); 19 | $stmt->bindValue(':username', $username, SQLITE3_TEXT); 20 | $stmt->bindValue(':password', $hashedPassword, SQLITE3_TEXT); 21 | $stmt->execute(); 22 | 23 | // Start the session and set admin login details 24 | session_start(); 25 | $_SESSION['admin'] = [ 26 | 'logged_in' => true, 27 | 'username' => $username 28 | ]; 29 | 30 | // Redirect to the Admin Dashboard 31 | header('Location: dashboard.php'); 32 | exit; 33 | } catch (Exception $e) { 34 | echo "Error: " . $e->getMessage(); 35 | } 36 | } 37 | ?> 38 | 39 | 40 | 41 | 42 | 43 | 44 | Create Admin Account 45 | 46 | 47 |
48 |

Create Admin Account

49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 | 57 |
58 |
59 | 60 | 61 |
62 | 63 |
64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /saveRole.php: -------------------------------------------------------------------------------- 1 | false, 'message' => 'No updates received.']); 11 | exit; 12 | } 13 | 14 | try { 15 | foreach ($data['updates'] as $update) { 16 | $id = intval($update['id']); 17 | $role_name = trim($update['role']); 18 | 19 | $role_number = intval($update['number']); 20 | 21 | 22 | $checkStmt = $db->prepare("SELECT COUNT(*) as count FROM volunteer_roles WHERE id = :id"); 23 | 24 | $checkStmt->bindValue(':id', $id, SQLITE3_INTEGER); 25 | 26 | $result = $checkStmt->execute()->fetchArray(SQLITE3_ASSOC); 27 | 28 | if ($result['count'] > 0) { 29 | // Update the existing record 30 | $stmt = $db->prepare("UPDATE volunteer_roles SET role_name = :role_name, role_number = :role_number WHERE id = :id"); 31 | } else { 32 | // Insert a new record 33 | $stmt = $db->prepare("INSERT INTO volunteer_roles (id, role_name, role_number) VALUES (:id, :role_name, :role_number)"); 34 | } 35 | 36 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 37 | $stmt->bindValue(':role_name', $role_name, SQLITE3_TEXT); 38 | $stmt->bindValue(':role_number', $role_number, SQLITE3_INTEGER); 39 | 40 | if (!$stmt->execute()) { 41 | echo json_encode(['success' => false, 'message' => 'Database operation failed.']); 42 | exit; 43 | } 44 | $updateSlotStmt = $db->prepare("UPDATE volunteer_slots 45 | SET max_volunteers = :role_number 46 | WHERE role_id = :id"); 47 | $updateSlotStmt->bindValue(':role_number', $role_number, SQLITE3_INTEGER); 48 | $updateSlotStmt->bindValue(':id', $id, SQLITE3_INTEGER); 49 | $updateSlotStmt->execute(); 50 | 51 | $updateSlotStmt = $db->prepare("UPDATE shift_availability_cache 52 | SET remaining_spots = :role_number 53 | WHERE role_id = :id"); 54 | $updateSlotStmt->bindValue(':role_number', $role_number, SQLITE3_INTEGER); 55 | $updateSlotStmt->bindValue(':id', $id, SQLITE3_INTEGER); 56 | $updateSlotStmt->execute(); 57 | 58 | echo json_encode(['success' => true, 'message' => "Data updated successfully."]); 59 | } 60 | 61 | echo json_encode(['success' => true, 'message' => "Data saved successfully."]); 62 | } catch (Exception $e) { 63 | echo json_encode(['success' => false, 'message' => $e->getMessage()]); 64 | } 65 | -------------------------------------------------------------------------------- /update_signup.php: -------------------------------------------------------------------------------- 1 | beginTransaction(); 25 | 26 | try { 27 | // Update the signup record 28 | $update_query = "UPDATE signups 29 | SET shift_id = ?, 30 | role_id = ?, 31 | volunteer_size = ?, 32 | updated_at = CURRENT_TIMESTAMP 33 | WHERE signup_id = ?"; 34 | 35 | $stmt = $pdo->prepare($update_query); 36 | $stmt->execute([ 37 | $data['shift_id'], 38 | $data['role_id'], 39 | $data['group_size'], 40 | $data['signup_id'] 41 | ]); 42 | 43 | // Check if any rows were affected 44 | if ($stmt->rowCount() === 0) { 45 | // If no existing record, insert new one 46 | $insert_query = "INSERT INTO signups 47 | (signup_id, shift_id, role_id, volunteer_size, created_at, updated_at) 48 | VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)"; 49 | 50 | $stmt = $pdo->prepare($insert_query); 51 | $stmt->execute([ 52 | $data['signup_id'], 53 | $data['shift_id'], 54 | $data['role_id'], 55 | $data['group_size'] 56 | ]); 57 | } 58 | 59 | // Get the current volunteer size for validation 60 | $size_query = "SELECT volunteer_size 61 | FROM signups 62 | WHERE signup_id = ?"; 63 | $stmt = $pdo->prepare($size_query); 64 | $stmt->execute([$data['signup_id']]); 65 | $result = $stmt->fetch(PDO::FETCH_ASSOC); 66 | 67 | $pdo->commit(); 68 | 69 | echo json_encode([ 70 | 'success' => true, 71 | 'volunteer_size' => $result['volunteer_size'] 72 | ]); 73 | 74 | } catch (Exception $e) { 75 | $pdo->rollBack(); 76 | throw $e; 77 | } 78 | 79 | } catch (Exception $e) { 80 | echo json_encode([ 81 | 'success' => false, 82 | 'message' => $e->getMessage() 83 | ]); 84 | } 85 | ?> -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT password FROM admin_users WHERE username = ?"); 15 | $stmt->bindValue(1, $username, SQLITE3_TEXT); 16 | $result = $stmt->execute(); 17 | $row = $result->fetchArray(SQLITE3_ASSOC); 18 | $db->close(); 19 | 20 | if ($row && password_verify($password, $row['password'])) { 21 | return true; 22 | } 23 | return false; 24 | } 25 | 26 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { 27 | $username = $_POST['username'] ?? ''; 28 | $password = $_POST['password'] ?? ''; 29 | 30 | if (verify_login($username, $password)) { 31 | // Set session for logged-in user 32 | $phote['admin'] = [ 33 | 'username' => $username, 34 | 'role' => 'admin', // Default role is admin; can expand to other roles 35 | 'logged_in' => true 36 | ]; 37 | header('Location: dashboard.php'); 38 | exit; // Ensure no further code is executed 39 | } else { 40 | $error = "Invalid username or password"; 41 | } 42 | } 43 | ?> 44 | 45 | 46 | 47 | 48 | 49 | 50 | Admin Login 51 | 52 | 53 |
54 |

Admin Login

55 |
56 | 57 |
58 | 59 |
60 |
61 | 62 | 63 |
64 |
65 | 66 | 67 |
68 | 69 |
70 |

Create an Account

71 |
72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /edit_volunteer.php: -------------------------------------------------------------------------------- 1 | prepare($query); 22 | $stmt->bindValue(':id', $id, SQLITE3_INTEGER); 23 | $result = $stmt->execute(); 24 | $record = $result ? $result->fetchArray(SQLITE3_ASSOC) : null; 25 | 26 | // Handle missing record 27 | if (!$record) { 28 | die("Error: Volunteer slot with id = $id not found in the database."); 29 | } 30 | 31 | // Handle form submission 32 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { 33 | $max_volunteers = intval($_POST['max_volunteers']); 34 | $updateQuery = "UPDATE volunteer_slots SET max_volunteers = :max_volunteers WHERE id = :id"; 35 | $updateStmt = $db->prepare($updateQuery); 36 | $updateStmt->bindValue(':max_volunteers', $max_volunteers, SQLITE3_INTEGER); 37 | $updateStmt->bindValue(':id', $id, SQLITE3_INTEGER); 38 | $updateStmt->execute(); 39 | 40 | header('Location: manage_volunteers.php?message=updated'); 41 | exit; 42 | } 43 | 44 | // Close the database connection 45 | $db->close(); 46 | ?> 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Edit Volunteer Slot 55 | 56 | 57 |
58 |

Edit Volunteer Slot

59 |
60 |
61 | 62 | 63 |
64 |
65 | 66 | 67 |
68 | 69 | Cancel 70 |
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /get_valid_shifts.php: -------------------------------------------------------------------------------- 1 | prepare(" 16 | SELECT sac.shift_id, r.day, r.time AS ride_time, 17 | STRFTIME('%I:%M %p', r.time) AS shift_start, 18 | STRFTIME('%I:%M %p', DATETIME(r.time, '+90 minutes')) AS shift_end, 19 | sac.remaining_spots, 20 | CASE 21 | WHEN sac.remaining_spots < :groupSize THEN 1 22 | ELSE 0 23 | END AS is_conditional 24 | FROM shift_availability_cache sac 25 | JOIN volunteer_slots vs ON sac.shift_id = vs.id 26 | JOIN rides r ON vs.ride_id = r.id 27 | WHERE vs.role_id = :roleId 28 | ORDER BY r.day, STRFTIME('%H:%M', r.time) 29 | "); 30 | 31 | // Bind parameters 32 | $stmt->bindValue(':rideId', $rideId, SQLITE3_INTEGER); 33 | $stmt->bindValue(':roleId', $roleId, SQLITE3_INTEGER); 34 | $stmt->bindValue(':groupSize', $groupSize, SQLITE3_INTEGER); 35 | 36 | $result = $stmt->execute(); 37 | $validShifts = []; 38 | $lastDay = null; 39 | 40 | // Process the results 41 | while ($shift = $result->fetchArray(SQLITE3_ASSOC)) { 42 | // Format the day abbreviation 43 | $dayAbbr = date('D', strtotime($shift['day'])); 44 | 45 | $rideStart = strtotime($shift['ride_time']); 46 | $isFirstRide = $lastDay !== $shift['day']; 47 | 48 | 49 | // First ride formula 50 | if ($isFirstRide) { 51 | $shiftStart = $rideStart - 1800; // 30 minutes before departure 52 | $shiftEnd = $shiftStart + 6300; // 105 minutes shift 53 | } else { 54 | // Subsequent rides formula 55 | $shiftStart = $rideStart - 900; // 15 minutes before departure 56 | $shiftEnd = $shiftStart + 5400; // 90 minutes shift 57 | } 58 | 59 | $shift['shift_start'] = date('h:i A', $shiftStart); 60 | $shift['shift_end'] = date('h:i A', $shiftEnd); 61 | 62 | // Create display text 63 | $shift['display_text'] = sprintf( 64 | "%s - %s - %s", 65 | $dayAbbr, 66 | $shift['shift_start'], 67 | $shift['shift_end'] 68 | ); 69 | 70 | // Add valid shifts to the array 71 | if ($shift['remaining_spots'] > 0 || $shift['is_conditional']) { 72 | $validShifts[] = $shift; 73 | } 74 | 75 | $lastDay = $shift['day']; 76 | } 77 | 78 | return $validShifts; 79 | } 80 | ?> -------------------------------------------------------------------------------- /master.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap'); 2 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap'); 3 | 4 | body { 5 | margin: 0; 6 | font-family: 'Open Sans', sans-serif; 7 | font-weight: 400; 8 | color: rgb(235, 235, 235) !important; 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | *{ 14 | margin:0; 15 | box-sizing: border-box; 16 | } 17 | input::placeholder { 18 | color: white; /* Placeholder text color */ 19 | opacity: 1; /* Ensure full visibility in some browsers */ 20 | } 21 | #login-window{ 22 | display:flex; 23 | justify-content:center; 24 | align-items:center; 25 | height: 100vh; 26 | width: 100vw; 27 | background-size: cover; 28 | background-position: center; 29 | background-image: url('./images/shutterstock_1640437144-scaled.webp'); 30 | background-repeat: no-repeat; 31 | } 32 | 33 | #login-box{ 34 | 35 | width:25%; 36 | min-width: 320px !important; 37 | box-shadow: 0px 0px 40px #d4d4d4; 38 | padding:1rem; 39 | } 40 | 41 | 42 | #logo{ 43 | display:flex; 44 | justify-content:center; 45 | margin:1rem 0; 46 | } 47 | 48 | .logo-font{ 49 | font-family: 'Dancing Script', cursive; 50 | font-weight: 600; 51 | font-size: 3rem; 52 | text-align: center; 53 | margin-bottom: 3rem; 54 | } 55 | 56 | .form{ 57 | margin:1rem 0; 58 | } 59 | 60 | .text-pale-light{ 61 | color: rgb(230, 230, 230) !important; 62 | } 63 | 64 | .full-opacity-bg{ 65 | background-color: transparent !important; 66 | } 67 | 68 | .rounded-custom{ 69 | border-radius: 20px !important; 70 | } 71 | 72 | .input{ 73 | padding:0.5rem; 74 | width:100%; 75 | font-size:1rem; 76 | font-weight:400; 77 | line-height:1.5; 78 | margin-top:8px 79 | } 80 | 81 | .rounded-custom-15{ 82 | border-radius: 15px !important; 83 | } 84 | 85 | .remember-section{ 86 | display:block; 87 | min-height: 1.5rem; 88 | margin:1rem 0; 89 | } 90 | 91 | .btn-hover { 92 | width: 200px; 93 | font-size: 16px; 94 | font-weight: 600; 95 | color: #fff; 96 | cursor: pointer; 97 | margin: 20px; 98 | height: 55px; 99 | text-align:center; 100 | border: none; 101 | background-size: 300% 100%; 102 | 103 | border-radius: 50px; 104 | moz-transition: all .4s ease-in-out; 105 | -o-transition: all .4s ease-in-out; 106 | -webkit-transition: all .4s ease-in-out; 107 | transition: all .4s ease-in-out; 108 | } 109 | 110 | .btn-hover:hover { 111 | background-position: 100% 0; 112 | moz-transition: all .4s ease-in-out; 113 | -o-transition: all .4s ease-in-out; 114 | -webkit-transition: all .4s ease-in-out; 115 | transition: all .4s ease-in-out; 116 | } 117 | 118 | .btn-hover:focus { 119 | outline: none; 120 | } 121 | 122 | .btn-hover.color-9 { 123 | background-color:#3D4267 124 | } -------------------------------------------------------------------------------- /get_available_groupsizes.php: -------------------------------------------------------------------------------- 1 | format('Y-m-d'); 35 | 36 | 37 | $rideStmt = $db->prepare("SELECT id FROM rides WHERE day = :day AND time = :time"); 38 | $rideStmt->bindValue(':day', $days, SQLITE3_TEXT); 39 | $rideStmt->bindValue(':time', $shift_start, SQLITE3_TEXT); 40 | $rideResult = $rideStmt->execute()->fetchArray(SQLITE3_ASSOC); 41 | 42 | if (!$rideResult) { 43 | throw new Exception("Ride not found for day: $days and time: $shift_start "); 44 | } 45 | $rideId = $rideResult['id']; 46 | 47 | 48 | $slotStmt = $db->prepare("SELECT id FROM volunteer_slots WHERE ride_id = :ride_id AND role_id = :role_id"); 49 | $slotStmt->bindValue(':ride_id', $rideId, SQLITE3_TEXT); 50 | $slotStmt->bindValue(':role_id', $roleId, SQLITE3_TEXT); 51 | $slotResult = $slotStmt->execute()->fetchArray(SQLITE3_ASSOC); 52 | 53 | if (!$slotResult) { 54 | throw new Exception("Volunteer slot not found for ride_id: $rideId and role_id: $roleId"); 55 | } 56 | $volunteerSlotId = $slotResult['id']; 57 | 58 | // Prepare SQL query 59 | $stmt = $db->prepare("SELECT remaining_spots 60 | FROM shift_availability_cache 61 | WHERE role_id = :roleId AND shift_id = :voltnteerslotId 62 | "); 63 | 64 | // Bind parameters correctly 65 | $stmt->bindValue(':voltnteerslotId', $volunteerSlotId, SQLITE3_TEXT); 66 | $stmt->bindValue(':roleId', $roleId, SQLITE3_TEXT); 67 | 68 | // Execute query 69 | $result = $stmt->execute(); 70 | if (!$result) { 71 | throw new Exception("Database query failed"); 72 | } 73 | 74 | // Fetch results 75 | $arrays = []; 76 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 77 | $arrays[] = $row; 78 | } 79 | echo json_encode([ 80 | 'success' => !empty($arrays), 81 | 'data' => $arrays, 82 | 'message' => empty($arrays) ? 'No data found' : 'Data retrieved successfully' 83 | ]); 84 | } catch (Exception $e) { 85 | // Return error response 86 | echo json_encode([ 87 | 'success' => false, 88 | 'error' => $e->getMessage() 89 | ]); 90 | } 91 | 92 | // Close database connection 93 | $db->close(); 94 | -------------------------------------------------------------------------------- /get_available_roles.php: -------------------------------------------------------------------------------- 1 | prepare('SELECT id FROM rides WHERE day = :day AND time = :shift_start'); 39 | $getRideQuery->bindValue(':shift_start', $shift_start, SQLITE3_TEXT); 40 | $getRideQuery->bindValue(':day', $day, SQLITE3_TEXT); 41 | $rideResult = $getRideQuery->execute(); 42 | 43 | if (!$rideResult) { 44 | throw new Exception("Failed to fetch ride_id"); 45 | } 46 | 47 | $rideRow = $rideResult->fetchArray(SQLITE3_ASSOC); 48 | if (!$rideRow) { 49 | throw new Exception("No ride found for the given start time"); 50 | } 51 | 52 | $ride_id = $rideRow['id']; 53 | 54 | // Prepare and execute query to get volunteer slots 55 | $stmt = $db->prepare('SELECT id FROM volunteer_slots WHERE ride_id = :ride_id'); 56 | $stmt->bindValue(':ride_id', $ride_id, SQLITE3_INTEGER); 57 | 58 | // Execute query 59 | $result = $stmt->execute(); 60 | 61 | // Fetch results into a simple array of IDs 62 | $slotIds = []; 63 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 64 | $slotIds[] = $row['id']; 65 | } 66 | // Debug array properly using print_r() 67 | 68 | // Fetch availability data for each slot 69 | $arrays = []; 70 | foreach ($slotIds as $slotId) { 71 | $availabilityStmt = $db->prepare('SELECT * FROM shift_availability_cache WHERE shift_id = :shift_id'); 72 | $availabilityStmt->bindValue(':shift_id', $slotId, SQLITE3_INTEGER); 73 | $availabilityResult = $availabilityStmt->execute(); 74 | 75 | while ($availRow = $availabilityResult->fetchArray(SQLITE3_ASSOC)) { 76 | $arrays[] = $availRow; 77 | } 78 | } 79 | 80 | 81 | // Return success response 82 | echo json_encode([ 83 | 'success' => true, 84 | 'data' => $arrays, 85 | 'message' => empty($arrays) ? 'No data found' : 'Data retrieved successfully' 86 | ]); 87 | } catch (Exception $e) { 88 | // Return error response 89 | echo json_encode([ 90 | 'success' => false, 91 | 'error' => $e->getMessage() 92 | ]); 93 | } 94 | 95 | // Close database connection 96 | $db->close(); 97 | -------------------------------------------------------------------------------- /role_signup.php: -------------------------------------------------------------------------------- 1 | prepare($query); 23 | $stmt->bindValue(':role_id', $role_id, SQLITE3_INTEGER); 24 | $result = $stmt->execute()->fetchArray(SQLITE3_ASSOC); 25 | 26 | if (!$result) { 27 | echo "Error: Role not found."; 28 | exit; 29 | } 30 | 31 | // Display role name 32 | $role_name = htmlspecialchars($result['role_name']); 33 | echo "

Role: $role_name

"; 34 | 35 | // Fetch slots for the role 36 | $slotsQuery = " 37 | SELECT vs.id AS slot_id, vs.category, r.day AS day, r.time AS time, vs.max_volunteers AS max_volunteers, 38 | COALESCE((SELECT SUM(num_people) FROM volunteer_signups WHERE slot_id = vs.id), 0) AS filled_volunteers 39 | FROM volunteer_slots vs 40 | JOIN rides r ON vs.ride_id = r.id 41 | JOIN ride_visibility rv ON vs.ride_id = rv.ride_id 42 | WHERE rv.role_id = :role_id AND rv.visible = 1 43 | ORDER BY r.day, r.time 44 | "; 45 | 46 | $stmt = $db->prepare($slotsQuery); 47 | $stmt->bindValue(':role_id', $role_id, SQLITE3_INTEGER); 48 | $slotsResult = $stmt->execute(); 49 | 50 | // Debugging Output for the Query 51 | echo "
Debugging Query Results:\n";
52 |     while ($row = $slotsResult->fetchArray(SQLITE3_ASSOC)) {
53 |         print_r($row);
54 |     }
55 |     echo "
"; 56 | 57 | // Reset the result for rendering 58 | $stmt = $db->prepare($slotsQuery); 59 | $stmt->bindValue(':role_id', $role_id, SQLITE3_INTEGER); 60 | $slotsResult = $stmt->execute(); 61 | 62 | // Render slots in a table 63 | if ($slotsResult) { 64 | $hasSlots = false; // Track if any slots are available 65 | 66 | echo ''; 67 | echo ''; 68 | echo ''; 69 | 70 | while ($row = $slotsResult->fetchArray(SQLITE3_ASSOC)) { 71 | $hasSlots = true; 72 | 73 | echo ''; 74 | echo ''; 75 | echo ''; 76 | echo ''; 77 | echo ''; 78 | echo ''; 79 | echo ''; 80 | } 81 | 82 | echo ''; 83 | echo '
DayTimeMax VolunteersFilled VolunteersAction
' . htmlspecialchars($row['day']) . '' . htmlspecialchars($row['time']) . '' . htmlspecialchars($row['max_volunteers']) . '' . htmlspecialchars($row['filled_volunteers']) . 'Sign Up
'; 84 | 85 | if (!$hasSlots) { 86 | echo '

No available slots for this role.

'; 87 | } 88 | } else { 89 | echo '

No available slots for this role.

'; 90 | } 91 | } catch (Exception $e) { 92 | echo "Error: " . $e->getMessage(); 93 | } 94 | ?> 95 | -------------------------------------------------------------------------------- /faqs.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 8 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 9 | $result = $stmt->execute(); 10 | $row = $result->fetchArray(SQLITE3_ASSOC); 11 | 12 | // Store content or set a default message 13 | $pageContent = $row['content'] ?? ""; 14 | // Fetch the footer content from the database 15 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 16 | $footerResult = $footerStmt->execute(); 17 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 18 | 19 | // Use retrieved footer content or fallback text 20 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 21 | ?> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | FAQs 30 | 69 | 70 | 71 | 72 |
73 |
74 |
75 | 76 |

FAQs

77 |
78 | 88 |
89 |
90 | 91 | 92 |
93 | 94 |
95 | 96 | 97 |
99 |

100 |
101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /sponsor_us.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 13 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 14 | $result = $stmt->execute(); 15 | $row = $result->fetchArray(SQLITE3_ASSOC); 16 | 17 | // Store content or set a default message 18 | $pageContent = $row['content'] ?? ""; 19 | 20 | 21 | // Fetch the footer content from the database 22 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 23 | $footerResult = $footerStmt->execute(); 24 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 25 | 26 | // Use retrieved footer content or fallback text 27 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 28 | ?> 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Sponsor Us 37 | 38 | 39 | 78 | 79 | 80 | 81 |
82 |
83 |
84 | 85 |

SPONSOR US

86 | 87 |
88 | 98 |
99 |
100 | 101 |
102 | 103 |
104 | 105 |
106 | 107 |
108 | 109 |
111 |

112 |
113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /merchandise.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 13 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 14 | $result = $stmt->execute(); 15 | $row = $result->fetchArray(SQLITE3_ASSOC); 16 | 17 | // Store content or set a default message 18 | $pageContent = $row['content'] ?? ""; 19 | 20 | 21 | // Fetch the footer content from the database 22 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 23 | $footerResult = $footerStmt->execute(); 24 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 25 | 26 | // Use retrieved footer content or fallback text 27 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 28 | ?> 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Merchandise 37 | 38 | 39 | 78 | 79 | 80 | 81 |
82 |
83 |
84 | 85 |

Merchandise

86 | 87 |
88 | 99 |
100 |
101 | 102 |
103 | 104 |
105 | 106 |
107 | 108 |
109 | 110 | 111 |
113 |

114 |
115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /ticket.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 12 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 13 | $result = $stmt->execute(); 14 | $row = $result->fetchArray(SQLITE3_ASSOC); 15 | 16 | // Store content or set a default message 17 | $pageContent = $row['content'] ?? ""; 18 | 19 | 20 | // Fetch the footer content from the database 21 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 22 | $footerResult = $footerStmt->execute(); 23 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 24 | 25 | // Use retrieved footer content or fallback text 26 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 27 | 28 | ?> 29 | 30 | 31 | 32 | 33 | 34 | Ticket 35 | 36 | 37 | 76 | 77 | 78 | 79 |
80 |
81 |
82 | 83 |

TICKETS

84 | 85 |
86 | 97 |
98 |
99 | 100 |
101 | 102 |
103 | Buy your tickets here 104 | 105 | 106 | 107 |
108 | 109 |
110 | 111 | 112 |
114 |

115 |
116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /signup.php: -------------------------------------------------------------------------------- 1 | prepare($insertQuery); 20 | $stmt->bindValue(':name', $name, SQLITE3_TEXT); 21 | $stmt->bindValue(':email', $email, SQLITE3_TEXT); 22 | $stmt->bindValue(':password', $password, SQLITE3_TEXT); 23 | $stmt->bindValue(':phone', $phone, SQLITE3_TEXT); 24 | 25 | if ($stmt->execute()) { 26 | $success = true; 27 | } else { 28 | $error = "This email is already registered."; 29 | } 30 | } 31 | 32 | // Fetch visible roles from the database 33 | $rolesQuery = "SELECT id, role_name FROM volunteer_roles WHERE visible = 1"; 34 | $rolesResult = $db->query($rolesQuery); 35 | $roles = []; 36 | while ($row = $rolesResult->fetchArray(SQLITE3_ASSOC)) { 37 | $roles[] = $row; 38 | } 39 | 40 | // Close the database connection 41 | $db->close(); 42 | ?> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Volunteer Signup 51 | 52 | 53 |
54 |

Volunteer Signup

55 | 56 | 57 |
Account created successfully! You can now choose your role below.
58 | 59 |
60 | 61 | 62 |
63 |

Create Your Account

64 |
65 | 66 | 67 |
68 |
69 | 70 | 71 |
72 |
73 | 74 | 75 |
76 |
77 | 78 | 79 |
80 | 81 |
82 | 83 |

Choose Your Role

84 |
85 | 86 | 87 | 88 | 89 | 90 |
91 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /manage_volunteers.php: -------------------------------------------------------------------------------- 1 | query($query); 11 | $roles = []; 12 | 13 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 14 | $id = $row['id']; 15 | $role_name = $row['role_name']; 16 | $role_number = $row['role_number']; 17 | 18 | $roles[] = [ 19 | 'id' => $id, 20 | 'role_name' => $role_name, 21 | 'role_number' => $role_number, 22 | ]; 23 | } 24 | } catch (Exception $e) { 25 | echo "Error: " . $e->getMessage(); 26 | exit; 27 | } 28 | ?> 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Manage Volunteers 38 | 39 | 40 | 41 |
42 |

Manage Volunteers

43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 |
RoleNumber
55 | 56 | 57 |
62 |
63 | 64 |
65 |
66 | 67 | Back to Dashboard 68 |
69 | 70 | 114 | 115 | -------------------------------------------------------------------------------- /role_selection.php: -------------------------------------------------------------------------------- 1 | query($query); 14 | 15 | $volunteer_id = $_SESSION['volunteer_id']; 16 | $query = "SELECT * FROM volunteer_signups WHERE volunteer_id = $volunteer_id"; 17 | $result = $db->query($query); 18 | $volunteer_signup = $result->fetchArray(SQLITE3_ASSOC); 19 | 20 | if ($volunteer_signup) { 21 | $edit_btn = 1; 22 | } else { 23 | $edit_btn = 0; 24 | } 25 | 26 | } catch (Exception $e) { 27 | echo "Error fetching roles: " . $e->getMessage(); 28 | exit; 29 | } 30 | ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Role Selection 41 | 69 | 70 | 71 | 72 |
73 |
74 |

Select a Role

75 |
76 | 77 | Edit My Selection
78 | 79 | 'signup_jolly_people.php', 83 | 2 => 'signup_elves.php', 84 | 3 => 'signup_chefs.php', 85 | 4 => 'signup_conductors.php', 86 | ]; 87 | 88 | // Display role links dynamically 89 | while ($role = $roles->fetchArray(SQLITE3_ASSOC)) { 90 | $role_name = htmlspecialchars($role['role_name']); 91 | $role_id = $role['id']; 92 | 93 | // Ensure there is a corresponding page for the role 94 | $page = $role_pages[$role_id] ?? '#'; 95 | 96 | // Include session ID to pass login info 97 | echo " 98 | Sign Up for $role_name 99 |
"; 100 | } 101 | ?> 102 |
103 |
104 | 105 |
106 |
107 |
108 | 109 | 110 | -------------------------------------------------------------------------------- /volunteer_portal.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Volunteer Portal 9 | 81 | 82 | 83 | 84 |
85 |
86 | 89 |

Volunteer Portal

90 |

Welcome to the Volunteer Portal! Please choose an option below to get started:

91 |
92 | 100 | 101 |
102 | Log In 103 | Sign Up 104 |
105 | 107 |
108 |
109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /volunteer_login.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT * FROM volunteers WHERE LOWER(email) = :email"); 11 | $stmt->bindValue(':email', $email, SQLITE3_TEXT); 12 | $result = $stmt->execute()->fetchArray(SQLITE3_ASSOC); 13 | if (!$result || !password_verify($password, $result['password'])) { 14 | $errorMessage = "Invalid email or password."; 15 | } else { 16 | // Set session for successful login 17 | $_SESSION['volunteer_logged_in'] = true; 18 | $_SESSION['volunteer_id'] = $result['id']; 19 | $_SESSION['volunteer_email'] = $result['email']; 20 | $_SESSION['volunteer_name'] = $result['name']; 21 | // echo $_SESSION['volunteer_name']; 22 | 23 | header('Location: role_selection.php'); // Redirect to role selection 24 | exit; 25 | } 26 | } catch (Exception $e) { 27 | $errorMessage = "Error: " . $e->getMessage(); 28 | } 29 | } 30 | ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Volunteer Login 39 | 40 | 41 | 77 | 78 | 79 | 80 |
81 |
82 | 85 |

Volunteer Login

86 | 87 |
88 | 89 |
90 | 91 |
92 |
93 |
94 |
95 |
96 | 97 | 98 |
99 |
100 |
101 |
102 |
103 | 104 | 105 | -------------------------------------------------------------------------------- /setup_event.php: -------------------------------------------------------------------------------- 1 | exec("DELETE FROM rides WHERE strftime('%Y', day) = '$eventYear'"); 18 | 19 | // Insert new rides for Day 1 20 | $time = strtotime($firstRideTime); 21 | for ($i = 0; $i < $ridesDay1; $i++) { 22 | $rideTime = date('h:i A', $time + ($rideDuration * $i * 60)); 23 | $db->exec("INSERT INTO rides (day, time) VALUES ('$day1', '$rideTime')"); 24 | $num = $db->lastInsertRowID(); 25 | 26 | for ($j = 1; $j <= 4; $j++) { 27 | $db->exec("INSERT INTO volunteer_slots (ride_id, role_id, max_volunteers) VALUES ('$num', '$j', $number[$j])"); 28 | $slotId = $db->lastInsertRowID(); 29 | $db->exec("INSERT INTO shift_availability_cache (shift_id, role_id, is_full, remaining_spots) 30 | VALUES ('$slotId', '$j', 0, $number[$j])"); // remainingspots = max_volunteers, isfull = 0 31 | } 32 | } 33 | 34 | for ($i = 0; $i < $ridesDay2; $i++) { 35 | $rideTime = date('h:i A', $time + ($rideDuration * $i * 60)); 36 | $db->exec("INSERT INTO rides (day, time) VALUES ('$day2', '$rideTime')"); 37 | $num = $db->lastInsertRowID(); 38 | 39 | 40 | for ($j = 1; $j <= 4; $j++) { 41 | $db->exec("INSERT INTO volunteer_slots (ride_id, role_id, max_volunteers) VALUES ('$num', '$j', $number[$j])"); 42 | $slotId = $db->lastInsertRowID(); 43 | 44 | // Insert into shift_availability_cache 45 | $db->exec("INSERT INTO shift_availability_cache (shift_id, role_id, is_full, remaining_spots) 46 | VALUES ('$slotId', '$j', 0, $number[$j])"); 47 | } 48 | $num++; 49 | } 50 | 51 | 52 | 53 | echo "
Event setup completed successfully!
"; 54 | } catch (Exception $e) { 55 | echo "
Error: " . $e->getMessage() . "
"; 56 | } 57 | } 58 | ?> 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Setup Event 67 | 68 | 69 | 70 |
71 |

Setup Event

72 |
73 |
74 | 75 | 76 |
77 |
78 | 79 | 80 |
81 |
82 | 83 | 84 |
85 |
86 | 87 | 88 |
89 |
90 | 91 | 92 |
93 |
94 | 95 | 96 |
97 |
98 | 99 | 100 |
101 | 102 |
103 | Back to Dashboard 104 | 105 |
106 | 107 | 108 | -------------------------------------------------------------------------------- /volunteer_signup.php: -------------------------------------------------------------------------------- 1 | prepare(" 24 | INSERT INTO volunteers (email, name, phone, password) 25 | VALUES (:email, :name, :phone, :password) 26 | "); 27 | $stmt->bindValue(':email', $email, SQLITE3_TEXT); 28 | $stmt->bindValue(':name', $name, SQLITE3_TEXT); 29 | $stmt->bindValue(':phone', $phone, SQLITE3_TEXT); 30 | $stmt->bindValue(':password', $hashedPassword, SQLITE3_TEXT); 31 | $stmt->execute(); 32 | 33 | // Automatically log the volunteer in 34 | $_SESSION['volunteer_logged_in'] = true; 35 | $_SESSION['volunteer_email'] = $email; 36 | $_SESSION['volunteer_name'] = $name; 37 | $_SESSION['volunteer_id'] = $db->lastInsertRowId(); 38 | 39 | // Redirect to role selection page 40 | header('Location: role_selection.php'); 41 | exit; 42 | } catch (Exception $e) { 43 | if (str_contains($e->getMessage(), 'UNIQUE constraint failed')) { 44 | $errorMessage = "An account with this email already exists."; 45 | } else { 46 | $errorMessage = "Error: " . $e->getMessage(); 47 | } 48 | } 49 | } 50 | } 51 | ?> 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Volunteer Sign Up 60 | 61 | 92 | 93 | 94 | 95 |
96 |
97 | 100 |

Volunteer Sign Up

101 | 102 |
103 | 104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | 113 | 114 |
115 |
116 |
117 |
118 |
119 | 120 | 121 | -------------------------------------------------------------------------------- /contact.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 11 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 12 | $result = $stmt->execute(); 13 | $row = $result->fetchArray(SQLITE3_ASSOC); 14 | 15 | // Store content or set a default message 16 | $pageContent = $row['content'] ?? ""; 17 | 18 | 19 | // Fetch the footer content from the database 20 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 21 | $footerResult = $footerStmt->execute(); 22 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 23 | 24 | // Use retrieved footer content or fallback text 25 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 26 | ?> 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Contact 37 | 145 | 146 | 147 | 148 |
149 |
150 |
151 | 152 |

Contact

153 |
154 | 164 |
165 |
166 | 167 |
168 | 169 |
170 | 171 | 172 |
174 |

175 |
176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /submit_selections.php: -------------------------------------------------------------------------------- 1 | false, 'message' => 'Invalid data structure or missing required fields']); 12 | exit; 13 | } 14 | 15 | // Ensure the volunteer is logged in 16 | $volunteerId = $_SESSION['volunteer_id'] ?? null; 17 | if (!$volunteerId) { 18 | echo json_encode(['success' => false, 'message' => 'User not logged in']); 19 | exit; 20 | } 21 | 22 | try { 23 | $db->exec('BEGIN TRANSACTION'); 24 | 25 | foreach ($data as $ride) { 26 | $slotId = (int) $ride['slotId']; 27 | $partySize = (int) $ride['partySize']; 28 | $notes = $ride['notes'] ?? ''; 29 | 30 | $rideStmt = $db->prepare("SELECT ride_id FROM volunteer_slots WHERE id = :slot_id"); 31 | $rideStmt->bindValue(':slot_id', $slotId, SQLITE3_INTEGER); 32 | $result = $rideStmt->execute(); 33 | $ride = $result->fetchArray(SQLITE3_ASSOC); 34 | if (!$ride) { 35 | die(json_encode(['success' => false, 'message' => 'No ride found for this slot ID.'])); 36 | } 37 | 38 | $rideId = $ride['ride_id']; 39 | $slotStmt = $db->prepare("SELECT id FROM volunteer_slots WHERE ride_id = :ride_id"); 40 | $slotStmt->bindValue(':ride_id', $rideId, SQLITE3_INTEGER); 41 | $result = $slotStmt->execute(); 42 | $slots = []; 43 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 44 | $slots[] = $row['id']; 45 | $signupStmt = $db->prepare("SELECT * FROM volunteer_signups WHERE volunteer_id = :volunteer_id AND slot_id = :slot_id"); 46 | $signupStmt->bindValue(':volunteer_id', $volunteerId, SQLITE3_INTEGER); 47 | $signupStmt->bindValue(':slot_id', $row['id'], SQLITE3_INTEGER); 48 | $result = $signupStmt->execute(); 49 | $signups = $result->fetchArray(SQLITE3_ASSOC); 50 | } 51 | if (!empty($signups)) { 52 | die(json_encode(['success' => false, 'message' => 'You have already registered this slot.'])); 53 | exit; 54 | } 55 | 56 | // Check if user already registered for this slot 57 | $checkExistingStmt = $db->prepare(" 58 | SELECT COUNT(*) as count 59 | FROM volunteer_signups 60 | WHERE slot_id = :slot_id AND volunteer_id = :volunteer_id 61 | "); 62 | $checkExistingStmt->bindValue(':slot_id', $slotId, SQLITE3_INTEGER); 63 | $checkExistingStmt->bindValue(':volunteer_id', $volunteerId, SQLITE3_INTEGER); 64 | $result = $checkExistingStmt->execute(); 65 | $existing = $result->fetchArray(SQLITE3_ASSOC); 66 | 67 | if ($existing['count'] > 0) { 68 | echo json_encode(['success' => false, 'message' => "You have already registered this slot."]); 69 | $db->exec('ROLLBACK'); 70 | exit; 71 | } 72 | 73 | // Check if the ride has enough available slots 74 | $availabilityStmt = $db->prepare(" 75 | SELECT max_volunteers - COALESCE((SELECT SUM(num_people) FROM volunteer_signups WHERE slot_id = :slot_id), 0) AS available_slots 76 | FROM volunteer_slots 77 | WHERE id = :slot_id 78 | "); 79 | $availabilityStmt->bindValue(':slot_id', $slotId, SQLITE3_INTEGER); 80 | $availabilityResult = $availabilityStmt->execute(); 81 | $availability = $availabilityResult->fetchArray(SQLITE3_ASSOC); 82 | 83 | if (!$availability || $partySize > $availability['available_slots']) { 84 | echo json_encode(['success' => false, 'message' => "Not enough available slots for Slot."]); 85 | $db->exec('ROLLBACK'); 86 | exit; 87 | } 88 | 89 | // Update remaining spots in shift_availability_cache 90 | $updateStmt = $db->prepare("UPDATE shift_availability_cache 91 | SET remaining_spots = remaining_spots - :party_size, 92 | is_full = CASE 93 | WHEN (remaining_spots - :party_size) <= 0 THEN 1 94 | ELSE 0 95 | END 96 | WHERE shift_id = :slot_id "); 97 | $updateStmt->bindValue(':party_size', $partySize, SQLITE3_INTEGER); 98 | $updateStmt->bindValue(':slot_id', $slotId, SQLITE3_INTEGER); 99 | $updateStmt->execute(); 100 | 101 | // Insert the volunteer signup 102 | $stmt = $db->prepare(" 103 | INSERT INTO volunteer_signups (slot_id, volunteer_id, num_people, notes) 104 | VALUES (:slot_id, :volunteer_id, :num_people, :notes) 105 | "); 106 | $stmt->bindValue(':slot_id', $slotId, SQLITE3_INTEGER); 107 | $stmt->bindValue(':volunteer_id', $volunteerId, SQLITE3_INTEGER); 108 | $stmt->bindValue(':num_people', $partySize, SQLITE3_INTEGER); 109 | $stmt->bindValue(':notes', $notes, SQLITE3_TEXT); 110 | $stmt->execute(); 111 | } 112 | 113 | $db->exec('COMMIT'); 114 | echo json_encode(['success' => true, 'message' => 'Selections successfully submitted']); 115 | } catch (Exception $e) { 116 | $db->exec('ROLLBACK'); 117 | echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]); 118 | } 119 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | The Polar Express 7 | 152 | 153 | 154 | 155 |
156 | Polar Express Header 157 | 158 | 159 | 169 | 170 | 171 |
172 | 173 | 183 |
184 |
185 | 186 | 187 |
188 | 189 | 190 |
191 |

Presented by White River Rotary Club

192 | 193 | Rotary Club Logo 194 | 195 | Visit the Rotary Club 196 |
197 |
198 | 199 | 200 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = 'index.php'"); 11 | $result = $stmt->execute(); 12 | $row = $result->fetchArray(SQLITE3_ASSOC); 13 | $homepage_content = $row['content'] ?? "

Welcome to the Polar Express

Enjoy a magical ride with us!

"; 14 | 15 | 16 | // Fetch the footer content from the database 17 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 18 | $footerResult = $footerStmt->execute(); 19 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 20 | 21 | // Use retrieved footer content or fallback text 22 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 23 | 24 | ?> 25 | 26 | 27 | 28 | 29 | 30 | 31 | The Polar Express 32 | 33 | 178 | 179 | 180 | 181 | 182 |
183 | Polar Express Header 184 | 185 | 186 | 196 | 197 | 198 |
199 | 200 | 210 |
211 |
212 | 213 | 214 |
215 | 216 |
217 | 218 | 219 |
220 |

Presented by White River Rotary Club

221 | 222 | Rotary Club Logo 223 | 224 | Visit the Rotary Club 225 |
226 | 227 | 228 |
230 |

231 |
232 | 233 | 234 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /manage_content.php: -------------------------------------------------------------------------------- 1 | trim($_POST['event_days']), 18 | 'first_ride_time' => trim($_POST['first_ride_time']), 19 | 'ticket_prices' => trim($_POST['ticket_prices']), 20 | 'footer' => trim($_POST['footer']), 21 | ]; 22 | 23 | // Save to file 24 | if (file_put_contents('information.txt', json_encode($content))) { 25 | $message = '
Content updated successfully!
'; 26 | } else { 27 | $message = '
Error saving content. Please check file permissions.
'; 28 | } 29 | } 30 | ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Manage Site Content 42 | 70 | 71 | 72 | 73 |
74 |

Manage Site Content

75 | 76 |
77 |
78 |
79 |
80 | 81 |
82 |
83 |
84 | 85 | 86 | 87 | 88 | 95 |
96 |
97 |
98 | 100 | 101 |
102 | 103 |
104 |
105 |
106 |
107 |
108 | 109 | 110 | 111 | 112 | 119 |
120 |
121 |
122 | 124 |
125 | 126 |
127 |
128 |
129 |
130 |
131 | 132 | 133 | 134 | 135 | 142 |
143 |
144 |
145 | 147 |
148 |
149 |
150 |
151 |
152 | 154 |
155 |
156 | 157 |
158 |
159 | Back to Dashboard 160 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /gallery.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 12 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 13 | $result = $stmt->execute(); 14 | $row = $result->fetchArray(SQLITE3_ASSOC); 15 | 16 | // Store content or set a default message 17 | $pageContent = $row['content'] ?? ""; 18 | 19 | 20 | // Fetch the footer content from the database 21 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 22 | $footerResult = $footerStmt->execute(); 23 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 24 | 25 | // Use retrieved footer content or fallback text 26 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 27 | ?> 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Photo Gallery - Hartford Polar Express 36 | 37 | 38 | 150 | 151 | 152 | 153 |
154 |
155 |
156 | 157 |

PHOTO GALLERY

158 |
159 | 169 |
170 |
171 | 172 |
173 | 174 |
175 | 176 |
177 | X 178 | Full screen view 179 |
180 | 181 |
182 | 183 |
184 | 185 |
187 |

188 |
189 | 190 | 191 | 260 | 261 | -------------------------------------------------------------------------------- /update_signups.php: -------------------------------------------------------------------------------- 1 | false, 'message' => 'Invalid JSON received.']); 21 | exit; 22 | } 23 | 24 | // Check if 'updates' key exists 25 | if (!isset($data['updates']) || empty($data['updates'])) { 26 | echo json_encode(['success' => false, 'message' => 'No updates received.']); 27 | exit; 28 | } 29 | 30 | try { 31 | $db->exec('BEGIN TRANSACTION'); 32 | $updatedCount = 0; 33 | 34 | for ($i = 0; $i < count($data['updates']); $i++) { 35 | for ($j = $i + 1; $j < count($data['updates']); $j++) { 36 | $firstShiftDay = $data['updates'][$i]['current_values']['date']; 37 | $secondShiftDay = $data['updates'][$j]['current_values']['date']; 38 | $firstShiftTime = $data['updates'][$i]['current_values']['time']; 39 | $secondShiftTime = $data['updates'][$j]['current_values']['time']; 40 | 41 | // Adjust the time format and create proper datetime values 42 | $firstShiftStart = date('h:i A', strtotime($firstShiftTime) + 900); 43 | $secondShiftStart = date('h:i A', strtotime($secondShiftTime) + 900); 44 | $first_days = DateTime::createFromFormat('Y-m-d', $firstShiftDay)->format('Y-m-d'); 45 | $second_days = DateTime::createFromFormat('Y-m-d', $secondShiftDay)->format('Y-m-d'); 46 | 47 | // Query for the first ride 48 | $firstStmt = $db->prepare("SELECT id FROM rides WHERE day = :day AND time = :time"); 49 | $firstStmt->bindValue(':day', $first_days, SQLITE3_TEXT); 50 | $firstStmt->bindValue(':time', $firstShiftStart, SQLITE3_TEXT); 51 | $firstResult = $firstStmt->execute(); // Execute the query 52 | 53 | if ($first = $firstResult->fetchArray(SQLITE3_ASSOC)) { 54 | $firstRideId = $first['id']; 55 | } 56 | // Query for the second ride 57 | $secondStmt = $db->prepare("SELECT id FROM rides WHERE day = :day AND time = :time"); 58 | $secondStmt->bindValue(':day', $second_days, SQLITE3_TEXT); 59 | $secondStmt->bindValue(':time', $secondShiftStart, SQLITE3_TEXT); 60 | $secondResult = $secondStmt->execute(); // Execute the query 61 | 62 | if ($second = $secondResult->fetchArray(SQLITE3_ASSOC)) { 63 | $secondRideId = $second['id']; 64 | } 65 | 66 | // Compare ride IDs 67 | if ($firstRideId == $secondRideId) { 68 | echo json_encode([ 69 | 'success' => false, 70 | 'message' => "You already have a signup for this shift." 71 | ]); 72 | exit; 73 | } 74 | } 75 | } 76 | 77 | foreach ($data['updates'] as $update) { 78 | 79 | $signupId = intval($update['signup_id']); 80 | $slotId = intval($update['current_values']['shift']); 81 | $numPeople = intval($update['current_values']['groupSize']); 82 | $notes = trim($update['current_values']['notes']); 83 | $roleId = intval($update['current_values']['role']); 84 | $day = trim($update['current_values']['date']); 85 | $time = trim($update['current_values']['time']); 86 | 87 | $originalGroupSize = intval($update['original_values']['groupSize']); 88 | $originalRoleId = trim($update['original_values']['role']); 89 | $originalSlotId = trim($update['original_values']['shift']); 90 | 91 | 92 | if ($numPeople == 0) { 93 | echo json_encode(['success' => false, 'message' => 'Group size cannot be zero.']); 94 | exit; 95 | } 96 | 97 | // Update Original Cache remaining spots in shift_available_cache 98 | $cacheStmt = $db->prepare(" 99 | UPDATE shift_availability_cache 100 | SET 101 | remaining_spots = remaining_spots + :num_people, 102 | is_full = CASE 103 | WHEN is_full = 1 THEN 0 104 | ELSE is_full 105 | END 106 | WHERE shift_id = :original_slot_id AND role_id = :original_role_id 107 | "); 108 | $cacheStmt->bindValue(':num_people', $originalGroupSize, SQLITE3_INTEGER); 109 | $cacheStmt->bindValue(':original_slot_id', $originalSlotId, SQLITE3_INTEGER); 110 | $cacheStmt->bindValue(':original_role_id', $originalRoleId, SQLITE3_INTEGER); 111 | if (!$cacheStmt->execute()) { 112 | throw new Exception("Failed to update remaining spots in cache"); 113 | } 114 | 115 | $shift_start = date('h:i A', strtotime($time) + 900); 116 | $days = DateTime::createFromFormat('Y-m-d', $day)->format('Y-m-d'); 117 | 118 | // Get ride_id based on day and time 119 | $rideStmt = $db->prepare(" 120 | SELECT id FROM rides 121 | WHERE day = :day AND time = :time 122 | "); 123 | $rideStmt->bindValue(':day', $days, SQLITE3_TEXT); 124 | $rideStmt->bindValue(':time', $shift_start, SQLITE3_TEXT); 125 | $rideResult = $rideStmt->execute(); 126 | 127 | if ($ride = $rideResult->fetchArray(SQLITE3_ASSOC)) { 128 | $rideId = $ride['id']; 129 | } else { 130 | throw new Exception("No ride found for date: $days and time: $shift_start"); 131 | } 132 | 133 | // Get volunteer_slot_id based on ride_id and role_id 134 | $slotStmt = $db->prepare(" 135 | SELECT id FROM volunteer_slots 136 | WHERE ride_id = :ride_id AND role_id = :role_id 137 | "); 138 | $slotStmt->bindValue(':ride_id', $rideId, SQLITE3_INTEGER); 139 | $slotStmt->bindValue(':role_id', $roleId, SQLITE3_INTEGER); 140 | $slotResult = $slotStmt->execute(); 141 | 142 | if ($slot = $slotResult->fetchArray(SQLITE3_ASSOC)) { 143 | $volunteerSlotId = $slot['id']; 144 | } else { 145 | throw new Exception("No volunteer slot found for ride_id: $rideId and role_id: $roleId"); 146 | } 147 | 148 | //check remaining spots in cache 149 | $cacheStmt = $db->prepare(" 150 | SELECT remaining_spots FROM shift_availability_cache 151 | WHERE shift_id = :volunteer_slot_id AND role_id = :role_id 152 | "); 153 | $cacheStmt->bindValue(':volunteer_slot_id', $volunteerSlotId, SQLITE3_INTEGER); 154 | $cacheStmt->bindValue(':role_id', $roleId, SQLITE3_INTEGER); 155 | $cacheResult = $cacheStmt->execute(); 156 | $cache = $cacheResult->fetchArray(SQLITE3_ASSOC); 157 | 158 | if ($cache) { 159 | $remainingSpots = $cache['remaining_spots']; 160 | if ($remainingSpots <= 0 || $remainingSpots < $numPeople) { 161 | echo json_encode([ 162 | 'success' => false, 163 | 'message' => "Not enough spots available. Please reduce the group size." 164 | ]); 165 | exit; 166 | } 167 | } 168 | 169 | // Then update the cache with new values 170 | $newCacheStmt = $db->prepare(" 171 | UPDATE shift_availability_cache 172 | SET 173 | remaining_spots = remaining_spots - :num_people, 174 | is_full = CASE 175 | WHEN remaining_spots - :num_people <= 0 THEN 1 176 | ELSE is_full 177 | END 178 | WHERE shift_id = :volunteer_slot_id AND role_id = :role_id"); 179 | 180 | $newCacheStmt->bindValue(':num_people', $numPeople, SQLITE3_INTEGER); 181 | $newCacheStmt->bindValue(':volunteer_slot_id', $volunteerSlotId, SQLITE3_INTEGER); 182 | $newCacheStmt->bindValue(':role_id', $roleId, SQLITE3_INTEGER); 183 | 184 | if (!$newCacheStmt->execute()) { 185 | throw new Exception("Failed to update remaining spots in cache for new slot"); 186 | } 187 | 188 | // Delete volunteer signup 189 | $stmt = $db->prepare(" 190 | DELETE FROM volunteer_signups 191 | WHERE slot_id = :ride_id AND volunteer_id = :volunteer_id 192 | "); 193 | 194 | $stmt->bindValue(':ride_id', $originalSlotId, SQLITE3_INTEGER); 195 | $stmt->bindValue(':volunteer_id', $signupId, SQLITE3_INTEGER); 196 | 197 | 198 | if ($stmt->execute()) { 199 | // Insert new volunteer signup 200 | $insertStmt = $db->prepare(" 201 | INSERT INTO volunteer_signups (volunteer_id, slot_id, num_people, notes) 202 | VALUES (:signup_id, :slot_id, :num_people, :notes) 203 | "); 204 | 205 | $insertStmt->bindValue(':signup_id', $signupId, SQLITE3_INTEGER); 206 | $insertStmt->bindValue(':slot_id', $volunteerSlotId, SQLITE3_INTEGER); 207 | $insertStmt->bindValue(':num_people', $numPeople, SQLITE3_INTEGER); 208 | $insertStmt->bindValue(':notes', $notes, SQLITE3_TEXT); 209 | 210 | if ($insertStmt->execute()) { 211 | $updatedCount++; 212 | } else { 213 | $error = $db->lastErrorMsg(); 214 | throw new Exception("SQL Error: $error"); 215 | } 216 | } else { 217 | $error = $db->lastErrorMsg(); 218 | throw new Exception("SQL Error: $error"); 219 | } 220 | } 221 | 222 | // Send a generic success message 223 | $responseMessage = $updatedCount > 0 ? "All changes successfully recorded." : "No changes were test @debug."; 224 | $response = ['success' => true, 'message' => $responseMessage]; 225 | $db->exec('COMMIT'); 226 | 227 | echo json_encode($response); 228 | } catch (Exception $e) { 229 | // Handle exceptions 230 | $errorResponse = ['success' => false, 'message' => $e->getMessage()]; 231 | echo json_encode($errorResponse); 232 | } 233 | -------------------------------------------------------------------------------- /view_role.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT role_name FROM volunteer_roles WHERE id = :role_id"); 17 | $roleQuery->bindValue(':role_id', $role_id, SQLITE3_INTEGER); 18 | $roleResult = $roleQuery->execute(); 19 | $role = $roleResult->fetchArray(SQLITE3_ASSOC); 20 | 21 | if (!$role) { 22 | echo "Error: Role not found."; 23 | exit; 24 | } 25 | 26 | $role_name = $role['role_name']; 27 | 28 | // Fetch rides and volunteer slots for the selected role 29 | $query = "SELECT r.day, r.time, vs.id AS slot_id, vs.max_volunteers, 30 | COALESCE((SELECT SUM(num_people) FROM volunteer_signups WHERE slot_id = vs.id), 0) AS filled_slots, 31 | vs.max_volunteers - COALESCE((SELECT SUM(num_people) FROM volunteer_signups WHERE slot_id = vs.id), 0) AS remaining_slots FROM rides r 32 | LEFT JOIN volunteer_slots vs ON r.id = vs.ride_id AND vs.role_id = :role_id 33 | ORDER BY r.day ASC, r.time ASC 34 | "; 35 | $stmt = $db->prepare($query); 36 | $stmt->bindValue(':role_id', $role_id, SQLITE3_INTEGER); 37 | $result = $stmt->execute(); 38 | 39 | $rides = []; 40 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { 41 | // Format the day as "Day of Week, MM/DD/YYYY" 42 | $date = DateTime::createFromFormat('Y-m-d', $row['day']); 43 | $row['day'] = $date ? $date->format('l, m/d/Y') : $row['day']; 44 | 45 | // Ensure default values for slots 46 | $row['max_volunteers'] = $row['max_volunteers'] ?? 0; 47 | $row['filled_slots'] = $row['filled_slots'] ?? 0; 48 | $row['remaining_slots'] = $row['max_volunteers'] - $row['filled_slots']; 49 | 50 | $rides[] = $row; 51 | } 52 | } catch (Exception $e) { 53 | echo "Error: " . $e->getMessage(); 54 | exit; 55 | } 56 | ?> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | View Role 66 | 71 | 72 | 73 | 74 |
75 |

Role:

76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 94 | 95 | 96 | 97 | 98 | 99 | 102 | 111 | 116 | 117 | 118 | 119 |
DayTimeMax SlotsFilled SlotsRemaining SlotsVolunteersActions
100 | 101 | 103 | 0): ?> 104 | 105 | View Volunteers 106 | 107 | 108 | No Volunteers 109 | 110 | 112 | 115 |
120 | Back to Roles 121 |
122 | 123 | 167 | 168 | 169 | 170 | 215 | 216 | -------------------------------------------------------------------------------- /sponsors.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT content FROM page_content WHERE page_name = :pageName"); 10 | $stmt->bindValue(':pageName', $pageName, SQLITE3_TEXT); 11 | $result = $stmt->execute(); 12 | $row = $result->fetchArray(SQLITE3_ASSOC); 13 | 14 | // Store content or set a default message 15 | $pageContent = $row['content'] ?? ""; 16 | 17 | 18 | // Fetch the footer content from the database 19 | $footerStmt = $db->prepare("SELECT content FROM page_content WHERE page_name = 'footer'"); 20 | $footerResult = $footerStmt->execute(); 21 | $footerRow = $footerResult->fetchArray(SQLITE3_ASSOC); 22 | 23 | // Use retrieved footer content or fallback text 24 | $footerContent = $footerRow && isset($footerRow['content']) ? $footerRow['content'] : "

Footer content goes here.

"; 25 | ?> 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Sponsors 37 | 166 | 167 | 168 | 169 |
170 |
171 |
172 | 173 |

SPONSORS

174 |
175 | 185 |
186 |
187 |
188 | 191 |
192 |
193 | 194 |
195 | 196 |
197 | 198 |
199 |
200 | X 201 | Full screen view 202 |
203 | 217 | 218 | 219 | 220 | 221 |
223 |

224 |
225 | 226 | 227 | 228 | 304 | 305 | -------------------------------------------------------------------------------- /editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Website Content Editor 7 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 37 |
38 | 39 |

Website Content Editor

40 | 41 | 42 | 48 | 49 | 50 |
51 |
52 | Font Size
53 | 54 | 55 | 56 |
57 | | 58 |
59 | Font Color
60 | 61 | 62 | 63 |
64 | | 65 |
66 | Text Style
67 | 68 | 69 | 70 |
71 | | 72 |
73 | Justification
74 | 75 | 76 | 77 |
78 | | 79 |
80 | Special Functions
81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 89 |
90 |
91 | 92 |
93 | 94 | 95 |
96 | 97 | 98 | 99 |
100 | 101 | 269 | 270 | 271 | 272 | --------------------------------------------------------------------------------