This is a small PHP + MySQL event website with a Bootstrap frontend. It includes:
- Landing page with events carousel and admin-managed events
- Admin authentication and event CRUD (create / update / delete)
- Registration form that stores users and links to event registrations
This README explains how to run the project locally, import the database schema, use the admin UI, and call the API.
- Windows with XAMPP (Apache + MySQL) installed and running, or another PHP + MySQL stack.
- A browser.
- (Optional) MySQL Workbench or
mysqlCLI for importing the schema.
- Start XAMPP (Apache and MySQL).
- Import the SQL schema to create the database and tables.
Using MySQL Workbench: open c:\xampp\htdocs\sql\schema.sql and execute it.
Or from PowerShell / Command Prompt (will prompt for MySQL password):
mysql -u root -p < "C:\xampp\htdocs\sql\schema.sql"- Open the site in your browser:
http://localhost/index.php
- Admin login page:
http://localhost/admin_login.html
Default admin credentials (for development only):
- Username:
admin - Password:
admin123
You can change these values in php/admin_auth.php or migrate to a proper users table.
- Go to
http://localhost/admin_login.htmland log in with admin credentials. - Return to
http://localhost/index.phpand you should see an Add Event button in the Events section. - Click Add Event, fill in the Title, Date, Description and Location, then Save.
The frontend will POST the data to php/events.php which creates the event in the events table.
You can create events by POSTing form-data to php/events.php. The endpoint expects an admin session, so either use the admin UI or perform a login first to obtain the session cookie.
Example using curl with cookie jar (PowerShell / CLI):
# 1) Login and save cookies
curl -c cookies.txt -X POST -F "action=login" -F "username=admin" -F "password=admin123" http://localhost/php/admin_auth.php
# 2) Create event using the same cookie jar
curl -b cookies.txt -X POST -F "action=create" -F "title=Networking Gala" -F "description=Evening of networking" -F "event_date=2025-06-05T19:00" -F "location=Chicago, IL" http://localhost/php/events.phpTo update or delete use action=update (include id) or action=delete (include id).
- The registration form on the landing page (and
cadastro.html) submits tophp/register.php. php/register.phpsaves user data intoregistrations.- If
event_idis provided in the registration, the script also creates a row inevent_registrationsthat links the user to the event.
To register via API you can post the form fields to php/register.php (AJAX from the site already wired up):
curl -X POST -F "name=Jane Doe" -F "email=jane@example.com" -F "event_id=1" -F "event_date=2025-06-05T19:00" http://localhost/php/register.phpindex.php— Landing page (Bootstrap) and events carouselcss/style.css— Project styles, fonts and colorsjs/script.js— Frontend JS for events, registration, and admin modalphp/events.php— Events API (GET list, GET single, POST create/update/delete)php/admin_auth.php— Simple admin login/logout (session-based)php/register.php— Register user + optional event registrationphp/fetch_users.php— Used byconsulta.phpto list registrationsadmin_login.html— Admin login pagesql/schema.sql— Database schema (create DB, registrations, event_registrations)
- The current admin credentials are stored in
php/admin_auth.phpas constants for simplicity — this is NOT secure for production. Move them to a hashed password in a database or environment variable. - All admin POST actions in
php/events.phprequire the sessionis_adminflag. If you add remote API access you should use token-based or more secure auth. - Input validation is minimal; consider adding server-side validation and CSRF protection.
- If the landing page reports a missing
eventstable, re-runsql/schema.sqlor visitindex.php— it will attempt to create theeventstable on first run (but database user needs CREATE privileges). - If static assets (fonts/icons) do not load, ensure your server has internet access or replace with local copies.
If you'd like, I can:
- Convert the project to use a shared
header.phpandfooter.phpto avoid duplicated navbars, - Add an admin dashboard page to list and manage events,
- Implement hashed admin users in the database,
- Add CSRF tokens and input validation.
Tell me which of these you'd like next and I'll implement it.