How psyclone20/library works
Project Type & Purpose
• This is a monolithic, server-rendered full-stack web application written in PHP.
• It supports two user roles—Member and Librarian—with workflows for registration, book requests, returns, penalties, and email notifications.
• It persists data in a MySQL (library_db) database and uses SMTP for outgoing email.
File Structure
• Top-level: LICENSE, README.md, db/, screenshots/, src/
• db/: Holds the database DDL (library_db.sql).
• src/: All PHP entry points, shared include files, CSS, images.
• src/db_connect.php: Database connection logic.
• src/header.php, src/message_display.php, src/logout.php, src/verify_logged_out.php: Common layout & session control.
• src/index.php: Public home/login landing.
• src/librarian/: Contains separate views & controllers for librarian workflows (insert_book.php, pending_registrations.php, due_handler.php, etc.).
• src/member/: Contains member workflows (register.php, my_books.php, etc.).
README for Key Behaviors
• Automatic email confirmations on registration & issue.
• Scheduled reminders & penalties for overdue books (due_handler.php likely invoked via cron).
• Role‐based access control: separate “verify_librarian.php” and “verify_member.php” guards.
Main Components & Their Interactions
a. User Clients
• Member’s Browser
• Librarian’s Browser
b. Web Server / PHP Application
• Authentication & Session Manager
• Member Module
• Librarian Module
• Notification Service (email logic invoked by user actions & scheduled via cron)
• Database Access Layer (db_connect.php + SQL queries)
c. Database
• MySQL instance hosting tables for users, books, issues, penalties, etc.
d. External Service
• SMTP mail server for sending notifications and reminders
Architectural Patterns & Tech
• Monolithic MVC‐style php scripts (each PHP file acts as a controller + view).
• Shared includes implement simple templating/layout (header.php).
• Scheduled batch job (due_handler.php) for periodic tasks.
• Role‐based access control through verify_*.php wrappers.