A comprehensive library management system built with HTML, CSS, JavaScript, PHP, and MySQL. The system allows users to browse, search, and reserve books, request new books, and manage their reservations. Administrators can manage books, reservations, and book requests.
- Home page with featured books and search
- Books catalog with advanced filtering
- Book detail pages with reservation functionality
- Services page with membership inquiry form
- About page with library information
- Contact form with message storage
- Book request system for unavailable books
- FAQ and Policies pages
- User registration and authentication
- Book reservation ("Mark as Mine") functionality
- Ability to cancel reservations
- View current and past reservations
- Request books not in the library
- Dashboard with statistics
- Full CRUD operations for books
- Manage reservations (view, reject with reason)
- Manage book requests (approve/reject with reasons)
- Option to add approved requests as new books
- Web Server (Apache/Nginx)
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Modern web browser
- Create a new MySQL database named
bookhaven - Import the
database.sqlfile to create tables and insert sample data:mysql -u root -p < database.sql
- Update the database credentials in
includes/db.phpif needed:define('DB_HOST', 'localhost'); // Your database host define('DB_NAME', 'bookhaven'); // Your database name define('DB_USER', 'root'); // Your database username define('DB_PASS', ''); // Your database password
Ensure the following directory structure exists:
/library-app/
/assets/
/css/style.css
/js/app.js
/includes/
db.php
auth.php
header.php
footer.php
functions.php
/admin/
index.php
books.php
reservations.php
requests.php
index.php
books.php
book.php
services.php
about.php
contact.php
request.php
my_reservations.php
login.php
register.php
logout.php
database.sql
README.md
Place the application files in your web server's document root (e.g., htdocs for XAMPP, www for WAMP).
After setup, you can log in to the admin panel using:
- Email:
admin@library.com - Password:
password123
The system uses the following tables:
users: Stores user information (name, email, password, role)books: Stores book information (title, author, category, ISBN, etc.)reservations: Tracks book reservations (user, book, status, etc.)book_requests: Manages user requests for new bookscontact_messages: Stores messages from the contact formmembership_inquiries: Stores membership inquiry forms
- Available copies = Total copies - Active reservations
- Reservation buttons are disabled when no copies are available
- Users cannot reserve the same book twice while it's active
ACTIVE: Currently reservedCANCELLED: User cancelledREJECTED: Admin rejected
PENDING: Awaiting admin reviewAPPROVED: Approved by adminREJECTED: Rejected by admin
- Prepared statements to prevent SQL injection
- Password hashing with PHP's password_hash()
- Session-based authentication
- Input validation and sanitization
- Role-based access control
db.php: Database connectionauth.php: Authentication functionsfunctions.php: Utility functionsheader.php: Common header templatefooter.php: Common footer template
assets/css/style.css: All stylingassets/js/app.js: JavaScript functionalityassets/images/icon.png: Main application icon (192x192 pixels)assets/images/favicon-16x16.png: 16x16 faviconassets/images/favicon-32x32.png: 32x32 faviconassets/images/apple-touch-icon.png: 180x180 Apple touch iconassets/images/site.webmanifest: Web app manifest for PWA support
Modify assets/css/style.css to customize the appearance of the application.
Add new features by extending the existing PHP functions in includes/functions.php.
- Database Connection Error: Verify database credentials in
includes/db.php - Permission Issues: Ensure web server has read/write access to necessary directories
- Page Not Found: Check that the file structure matches the expected organization
- Enable PHP error reporting during development
- Check MySQL error logs for database-related issues
- Verify that all required PHP extensions are installed
This system was built as a demonstration of full-stack development using core web technologies without frameworks. Contributions should maintain the simplicity and educational value of the codebase.
This project is created for educational purposes and can be used freely for learning and development.