|
| 1 | +# 🚀 Campus Pulse - Event Management System |
| 2 | + |
| 3 | +This is a full-stack event management system built with PHP, MySQL, CSS, and JavaScript. It provides a complete portal for two types of users: **Event Planners** (who can create and manage events) and **Attendees** (who can discover and register for events). |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## ✨ Core Features |
| 10 | + |
| 11 | +* **Dual User Roles:** Separate dashboards and permissions for 'Planners' and 'Users' (Attendees). |
| 12 | +* **Secure Authentication:** Secure user registration and login with password hashing. |
| 13 | +* **Full Event CRUD:** Planners can **C**reate, **R**ead, **U**pdate, and **D**elete their own events. |
| 14 | +* **Image Uploads:** Planners can upload a unique image for each event. |
| 15 | +* **Public Event Listings:** A homepage (`index.php`) that shows all upcoming events to the public. |
| 16 | +* **Event Registration:** Attendees can register for events. The "Register" button is smart—it only appears for logged-in users who haven't registered yet. |
| 17 | +* **Reporting:** |
| 18 | + * **For Planners:** View a list of all attendees registered for their event. |
| 19 | + * **For Users:** View a list of all events they are registered for. |
| 20 | +* **Responsive Design:** Features a sticky, transparent header and a hamburger menu for a clean mobile experience. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 🛠️ Tech Stack |
| 25 | + |
| 26 | +* **Backend:** PHP |
| 27 | +* **Database:** MySQL |
| 28 | +* **Frontend:** HTML5, CSS3 (Flexbox, Grid), JavaScript (ES6+) |
| 29 | +* **Development Environment:** XAMPP (Apache, MySQL) |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## ⚙️ How to Run Locally |
| 34 | + |
| 35 | +To get this project running on a local machine, follow these steps. |
| 36 | + |
| 37 | +### 1. Prerequisites |
| 38 | +* You must have **XAMPP** (or a similar PHP/MySQL environment) installed and running. |
| 39 | + |
| 40 | +### 2. Get the Code |
| 41 | +* Clone this repository into your `htdocs` folder (e.g., `C:/xampp/htdocs/event-system`). |
| 42 | + |
| 43 | +### 3. Database Setup |
| 44 | +1. Open phpMyAdmin (`http://localhost/phpmyadmin`). |
| 45 | +2. Create a new database named **`event_db`**. |
| 46 | +3. Go to the "SQL" tab and run the queries below to create the `users`, `events`, and `registrations` tables. |
| 47 | + |
| 48 | + **`users` table:** |
| 49 | + ```sql |
| 50 | + CREATE TABLE `users` ( |
| 51 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 52 | + `username` varchar(100) NOT NULL, |
| 53 | + `email` varchar(255) NOT NULL, |
| 54 | + `password` varchar(255) NOT NULL, |
| 55 | + `role` enum('user','planner') NOT NULL DEFAULT 'user', |
| 56 | + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), |
| 57 | + PRIMARY KEY (`id`), |
| 58 | + UNIQUE KEY `username` (`username`), |
| 59 | + UNIQUE KEY `email` (`email`) |
| 60 | + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| 61 | + ``` |
| 62 | + |
| 63 | + **`events` table:** |
| 64 | + ```sql |
| 65 | + CREATE TABLE `events` ( |
| 66 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 67 | + `title` varchar(255) NOT NULL, |
| 68 | + `description` text NOT NULL, |
| 69 | + `event_date` datetime NOT NULL, |
| 70 | + `location` varchar(255) NOT NULL, |
| 71 | + `event_image` varchar(255) DEFAULT NULL, |
| 72 | + `planner_id` int(11) NOT NULL, |
| 73 | + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), |
| 74 | + PRIMARY KEY (`id`), |
| 75 | + KEY `planner_id` (`planner_id`) |
| 76 | + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| 77 | + ``` |
| 78 | + |
| 79 | + **`registrations` table:** |
| 80 | + ```sql |
| 81 | + CREATE TABLE `registrations` ( |
| 82 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 83 | + `user_id` int(11) NOT NULL, |
| 84 | + `event_id` int(11) NOT NULL, |
| 85 | + `registered_at` timestamp NOT NULL DEFAULT current_timestamp(), |
| 86 | + PRIMARY KEY (`id`), |
| 87 | + UNIQUE KEY `user_event_unique` (`user_id`,`event_id`), |
| 88 | + KEY `event_id` (`event_id`) |
| 89 | + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| 90 | + ``` |
| 91 | + |
| 92 | +### 4. Create `db_connect.php` |
| 93 | +* In the main project folder, create a file named `db_connect.php`. |
| 94 | +* Paste this code inside it (it's set up for default XAMPP). |
| 95 | +
|
| 96 | + ```php |
| 97 | + <?php |
| 98 | + $servername = "localhost"; |
| 99 | + $username = "root"; |
| 100 | + $password = ""; // Your XAMPP password (usually empty) |
| 101 | + $dbname = "event_db"; |
| 102 | +
|
| 103 | + // Create connection |
| 104 | + $conn = new mysqli($servername, $username, $password, $dbname); |
| 105 | +
|
| 106 | + // Check connection |
| 107 | + if ($conn->connect_error) { |
| 108 | + die("Connection failed: " . $conn->connect_error); |
| 109 | + } |
| 110 | + $conn->set_charset("utf8"); |
| 111 | + ?> |
| 112 | + ``` |
| 113 | +
|
| 114 | +### 5. Create `uploads/` Folder |
| 115 | +* In the main project folder, create a new, empty folder named **`uploads`**. This is where event images will be stored. |
| 116 | +
|
| 117 | +### 6. You're Done! |
| 118 | +* Open your browser and go to **`http://localhost/event-system`** (or whatever you named the project folder). |
0 commit comments