Back

TMCACSA

Time Management Challenges Among College Student-Athletes

Technical Requirement Document

Version 1.0

Date
November 7, 2026
Prepared by
Student Name
Course / Subject
Final Project

Document Control

FieldValue
DocumentTechnical Requirement Document (TRD)
ProductTMCACSA - student-athlete time-management and wellbeing portal
Version1.0
GeneratedNovember 7, 2026
Prepared byStudent Name
Course / SubjectFinal Project
Related documentProduct Requirement Document (help/prd.php)
StatusDescribes the code as it exists today; planned items are labeled Planned and listed in Section 18.

1. Introduction

1.1 Purpose

This Technical Requirement Document (TRD) describes how TMCACSA is built: its architecture, technology stack, database, security controls, pages, and deployment needs. It is written from the source code of the application, so it records what the system really does today. Features that are specified but not yet built are clearly labeled Planned.

1.2 Scope

TMCACSA is a web application that lets college student-athletes record their schedule, time use, and tasks, answer a research survey, and view dashboards. Administrators review program-wide statistics, manage athlete records, read anonymous survey summaries, and export reports.

1.3 Intended audience

Instructors evaluating the project, developers who maintain it, and the system administrator who deploys it.

1.4 Related documents

The Product Requirement Document (help/prd.php) defines what the product must do and why. This document defines how it is implemented.

2. System Overview and Architecture

2.1 Architecture style

TMCACSA is a classic three-tier web application written in procedural PHP. There is no framework and no Composer dependency. Each page file contains its own request handling at the top and its HTML below, and shared logic lives in the includes folder.

2.2 Block diagram

Tier 1: ClientTier 2: Application serverTier 3: Data
Web browser (desktop or phone)
HTML5 pages, one stylesheet, vanilla JavaScript, Chart.js charts
PHP application behind the PHP built-in server (development) or Apache (hosting)
Pages, includes, session handling, security headers
MySQL database student_athlete_db
Accessed only through PDO prepared statements
Request path: Browser → HTTP or HTTPS → PHP page → PDO → MySQL → PHP builds HTML → Browser

2.3 Request flow

  1. The browser requests a page such as /athlete/timelog.php.
  2. The page loads config/config.php, config/db.php (PDO connection), includes/auth.php, and includes/functions.php.
  3. includes/auth.php configures the session cookie, starts the session, applies HTTPS enforcement when enabled, sends the security headers, and checks the idle timeout.
  4. The page calls require_role() or require_login() when it is protected.
  5. On a POST request the page verifies the CSRF token, validates the input, and runs prepared statements.
  6. After a successful change the page stores a flash message and redirects (Post/Redirect/Get).
  7. On a GET request the page queries the database, includes includes/header.php, renders HTML, and includes includes/footer.php.

3. Technology Stack

LayerTechnologyUse in TMCACSA
Server languagePHP 8 (development machine runs PHP 8.5)All page logic, sessions, validation, and report export. README requires PHP 8.0 or newer.
Database accessPDO with the pdo_mysql driverPrepared statements, exception error mode, associative fetch mode, native (non-emulated) prepares.
DatabaseMySQL 8.x, character set utf8mb4Stores users, records, survey data, logs, and login attempts.
MarkupHTML5Server-rendered pages with semantic elements.
StylingCSS3 in assets/css/style.cssSingle hand-written stylesheet: sidebar layout, cards, tables, forms, responsive rules, print rules.
Client scriptingVanilla JavaScript (assets/js/main.js, assets/js/charts.js)Sidebar and menu toggles, confirm dialogs, form checks, print and copy buttons, chart drawing.
ChartsChart.js loaded from cdn.jsdelivr.netDoughnut, bar, and line charts on dashboards and survey results.
Development toolsVisual Studio Code, GitHub Copilot, MySQL WorkbenchCoding, AI-assisted generation, and database design.
Local serverPHP built-in server (php -S localhost:8000)Local testing. XAMPP or MAMP with Apache is also supported.
Hosting (target)Shared hosting or VPS with Apache, PHP, MySQL, and SSLPublic deployment on a domain or subdomain.

4. Application Structure

4.1 Folder and file reference

PathPurpose
index.phpPublic landing page. Redirects a logged-in user to the correct dashboard.
create_admin.phpOne-time form that creates the first administrator. It refuses to run once an admin exists and should be deleted after setup.
.htaccessDisables directory listing (Options -Indexes) on Apache.
README.mdSetup, run, and admin creation instructions.
config/config.phpApplication constants (name, base URL, environment, HTTPS flag, session and lockout limits, backup settings).
config/db.phpCreates the PDO connection from the database settings variables.
includes/auth.phpSession cookie settings, session start, HTTPS and header setup, idle timeout, current_user, require_login, require_role, csrf_token, csrf_verify.
includes/functions.phpHelpers: e, redirect, flash, get_flash_messages, get_client_ip, set_security_headers, enforce_https, generate_captcha, verify_captcha, is_locked_out, record_login_attempt, clear_login_attempts, log_activity.
includes/header.phpHTML head, role-based sidebar, mobile top bar, Help menu, profile menu, flash messages.
includes/footer.phpCloses the layout and loads main.js.
auth/login.phpLogin with username, password, and CAPTCHA.
auth/register.phpAthlete self-registration with CAPTCHA.
auth/logout.phpPOST-only logout with CSRF check.
auth/settings.phpProfile update and password change for any logged-in user.
athlete/dashboard.phpAthlete statistics, charts, tasks, schedule, and balance alert.
athlete/schedule.phpWeekly schedule create, view, and delete.
athlete/timelog.phpTime log create, view, edit, delete, filter, and paginate.
athlete/tasks.phpTask create, view, edit, status change, delete, and filter.
athlete/survey.phpConsent-based survey with save and update.
admin/dashboard.phpProgram-wide statistics, charts, and overload table.
admin/athletes.phpAthlete search, filters, profile view, and delete.
admin/survey_results.phpAnonymous survey averages, distributions, and text answers.
admin/reports.phpFiltered reports and CSV exports.
help/prd.php and help/trd.phpProduct and Technical Requirement Documents, printable.
assets/css/style.cssThe only stylesheet.
assets/js/main.jsPage behavior without inline scripts.
assets/js/charts.jsReads page data and draws the Chart.js charts.

4.2 Design conventions

  • Procedural PHP, no classes, no autoloader, no framework.
  • Every database query that uses input is a prepared statement.
  • All output is escaped with the e() helper.
  • No inline JavaScript event handlers. Confirmations use a data-confirm attribute handled in main.js.
  • Relative links are built from the BASE_URL constant.

5. Database Design

Database name: student_athlete_db. Engine: InnoDB. Character set: utf8mb4.

5.1 users

ColumnTypeConstraints and notes
user_idINT UNSIGNEDPrimary key, auto increment
full_nameVARCHAR(100)Required
usernameVARCHAR(50)Required, unique. Used for login.
emailVARCHAR(120)Optional (NULL allowed), unique. Not used for login.
password_hashVARCHAR(255)Required. Output of password_hash().
roleENUM(athlete, admin)Default athlete
sportVARCHAR(60)Optional
year_levelENUM(1st Year, 2nd Year, 3rd Year, 4th Year)Optional
courseVARCHAR(100)Optional
created_atTIMESTAMPDefault current timestamp

5.2 categories

ColumnTypeConstraints and notes
category_idINT UNSIGNEDPrimary key, auto increment
nameVARCHAR(50)Unique. Seeded values: Class, Training, Game / Competition, Study, Rest / Sleep, Travel, Work, Personal / Social, Other.

5.3 time_logs

ColumnTypeConstraints and notes
log_idINT UNSIGNEDPrimary key, auto increment
user_idINT UNSIGNEDForeign key to users, ON DELETE CASCADE
category_idINT UNSIGNEDForeign key to categories
log_dateDATERequired
start_time, end_timeTIMERequired. The application requires end time later than start time.
hoursDECIMAL(4,2)GENERATED ALWAYS (stored): seconds between end and start divided by 3600. Never written by the application.
notesVARCHAR(255)Optional
created_atTIMESTAMPDefault current timestamp
Indexidx_logs_user_dateOn (user_id, log_date)

5.4 schedules

ColumnTypeConstraints and notes
schedule_idINT UNSIGNEDPrimary key, auto increment
user_idINT UNSIGNEDForeign key to users, ON DELETE CASCADE
category_idINT UNSIGNEDForeign key to categories
day_of_weekENUM(Mon, Tue, Wed, Thu, Fri, Sat, Sun)Required
start_time, end_timeTIMERequired
descriptionVARCHAR(150)Optional

5.5 tasks

ColumnTypeConstraints and notes
task_idINT UNSIGNEDPrimary key, auto increment
user_idINT UNSIGNEDForeign key to users, ON DELETE CASCADE
titleVARCHAR(150)Required
due_dateDATERequired
priorityENUM(Low, Medium, High)Default Medium
statusENUM(Pending, In Progress, Done)Default Pending
created_atTIMESTAMPDefault current timestamp
Indexidx_tasks_user_dueOn (user_id, due_date)

5.6 survey_questions

ColumnTypeConstraints and notes
question_idINT UNSIGNEDPrimary key, auto increment
question_textVARCHAR(300)Required
question_typeENUM(likert, text)Default likert
domainVARCHAR(60)Group heading. Seeded: 14 Likert and 2 open-ended questions.

5.7 survey_responses

ColumnTypeConstraints and notes
response_idINT UNSIGNEDPrimary key, auto increment
user_idINT UNSIGNEDForeign key to users, ON DELETE CASCADE
question_idINT UNSIGNEDForeign key to survey_questions, ON DELETE CASCADE
answer_valueTINYINT UNSIGNEDNULL allowed. CHECK value between 1 and 5.
answer_textTEXTNULL allowed. Used by text questions.
submitted_atTIMESTAMPDefault current timestamp
Unique keyuq_user_questionOn (user_id, question_id): one answer per question per athlete.

5.8 activity_logs

ColumnTypeConstraints and notes
log_idBIGINT UNSIGNEDPrimary key, auto increment
user_idINT UNSIGNEDNULL allowed. Foreign key to users, ON DELETE SET NULL.
username, roleVARCHAR(50), VARCHAR(10)Copied into the row so history stays readable if the account is deleted.
actionVARCHAR(40)Required. Action name such as LOGIN_SUCCESS.
detailsVARCHAR(255)Readable description. Never contains passwords.
ip_address, user_agentVARCHAR(45), VARCHAR(255)Request origin
created_atTIMESTAMPHolds both the date and the time of the activity.
Indexesidx_activity_created, idx_activity_user, idx_activity_actionSupport filtering by date, user, and action.

5.9 login_attempts

ColumnTypeConstraints and notes
attempt_idBIGINT UNSIGNEDPrimary key, auto increment
usernameVARCHAR(50)Username typed on the login form
ip_addressVARCHAR(45)Client address
successTINYINT(1)Default 0
attempted_atTIMESTAMPDefault current timestamp
Indexesidx_attempt_user_time, idx_attempt_ip_timeOn (username, attempted_at) and (ip_address, attempted_at)

5.10 Views

ViewPurposeUsed by
v_hours_per_categoryTotal hours per athlete per categoryDefined in the database; not used by a page yet.
v_survey_averagesAverage Likert score and response count per questionadmin/survey_results.php
v_weekly_balanceTraining, study, and rest hours per athlete for the last 7 daysadmin/dashboard.php (overload table)

5.11 Relationships (entity relationship summary)

Parent tableChild tableRelationshipOn delete
userstime_logsOne user has many time logsCASCADE
usersschedulesOne user has many schedule itemsCASCADE
userstasksOne user has many tasksCASCADE
userssurvey_responsesOne user has many survey answersCASCADE
usersactivity_logsOne user has many log entriesSET NULL
categoriestime_logsOne category is used by many time logsRestrict (default)
categoriesschedulesOne category is used by many schedule itemsRestrict (default)
survey_questionssurvey_responsesOne question has many answersCASCADE

6. Module Design

ModulePagesInputsProcessingTables usedOutputs
Authenticationauth/login.php, auth/register.php, auth/logout.phpUsername, password, CAPTCHA answer, registration fields, CSRF tokenCAPTCHA check, lockout check, password_verify, session creation, password_hash on registrationusers, login_attempts, activity_logsSession, redirect to dashboard, flash messages
Settingsauth/settings.phpName, optional email, sport, year, course, current and new passwordValidation, update by session user id, password re-hashusers, activity_logsUpdated profile, flash message
Weekly scheduleathlete/schedule.phpCategory, day, start and end time, descriptionValidation, overlap check (warning only), insert, delete by ownerschedules, categoriesWeekly table grouped by day
Time logathlete/timelog.phpDate, category, start and end time, notes, filters, page numberValidation, insert, update, delete by owner, filtered and paginated query, total hourstime_logs, categoriesLog table, total hours, pagination links
Tasksathlete/tasks.phpTitle, due date, priority, status, status filterValidation, insert, update, status change, delete by owner, overdue detectiontasksTask table with priority badges and overdue label
Surveyathlete/survey.phpConsent checkbox, Likert answers 1 to 5, text answersConsent check, required Likert check, transaction with INSERT ... ON DUPLICATE KEY UPDATEsurvey_questions, survey_responsesSaved answers, pre-filled form
Athlete dashboardathlete/dashboard.phpSession userWeekly aggregates, task counts, today schedule, balance alert ruletime_logs, categories, tasks, schedules, usersSummary cards, charts, lists
Admin dashboardadmin/dashboard.phpNoneProgram-wide aggregates and overload queryusers, time_logs, categories, survey_responses, v_weekly_balanceCards, chart, overload table
Athlete managementadmin/athletes.phpSearch text, sport, year level, profile id, delete requestFiltered query, profile query, delete with CSRFusers, time_logs, categories, survey_questions, survey_responsesAthlete table, profile section
Survey resultsadmin/survey_results.phpNoneView query for averages, distribution counts, anonymous text answersv_survey_averages, survey_questions, survey_responses, usersTables and charts per domain
Reportsadmin/reports.phpSport, year, date range, export typeFiltered queries, CSV streaming with fputcsv and UTF-8 BOMusers, time_logs, categories, survey_questions, survey_responses, tasksOn-screen tables and CSV downloads

7. Authentication, Session, and Access Control

7.1 Login flow

  1. A GET request to auth/login.php generates a new arithmetic CAPTCHA (addition of two whole numbers from 1 to 10) and stores only the answer in the session.
  2. On POST the page verifies the CSRF token.
  3. The CAPTCHA is checked first and is single use: the stored answer is removed after every check. A wrong answer stops processing and does not count as a login attempt.
  4. Empty username or password returns the generic message Invalid username or password.
  5. The lockout check runs next. If the limit is reached the page shows the remaining minutes and records LOGIN_LOCKED without checking the password.
  6. The user is looked up by username with a prepared statement. If the username does not exist, password_verify runs against a dummy hash so the response time does not reveal which usernames exist.
  7. On success the session receives the user data, session_regenerate_id(true) is called, failed attempts for that username are cleared, the password hash is upgraded if password_needs_rehash is true, LOGIN_SUCCESS is logged, and the user is redirected by role.
  8. On failure the attempt is stored in login_attempts, LOGIN_FAILED is logged, and a new CAPTCHA is generated.

7.2 Session settings

SettingValue
Cookie lifetimeSession cookie (ends when the browser closes)
HttpOnlyEnabled
SameSiteLax
Secure flagEnabled when the request is HTTPS and the host is not localhost
Strict modesession.use_strict_mode enabled
Idle timeoutSESSION_IDLE_MINUTES (30). On timeout the session is destroyed and the user sees "Your session expired. Please log in again."
RegenerationOn successful login
LogoutPOST only with CSRF check; session cleared, cookie expired, session destroyed

7.3 Access control matrix

Page groupGuestAthleteAdmin
index.php, help pagesAllowedAllowedAllowed
auth/login.php, auth/register.phpAllowedRedirected to dashboardRedirected to dashboard
create_admin.phpAllowed only while no admin existsNot applicableNot applicable
auth/settings.php, auth/logout.phpRedirected to loginAllowedAllowed
athlete/* pagesRedirected to loginAllowed (own data only)Redirected to admin dashboard with an error message
admin/* pagesRedirected to loginRedirected to athlete dashboard with an error messageAllowed

Every athlete query that reads or changes a record includes the session user id in its WHERE clause (for example WHERE log_id = :id AND user_id = :uid), so one athlete cannot read or change another athlete data.

8. Security Design

ThreatControlWhere implemented
SQL injectionPDO prepared statements with real (non-emulated) prepares; integer values validated and bound as integersconfig/db.php and every page that queries the database
Cross-site scripting (XSS)Output escaped with htmlspecialchars through e(); Content-Security-Policy limits scripts to the same site and cdn.jsdelivr.net; no inline event handlersincludes/functions.php, all pages
Cross-site request forgery (CSRF)Random 32-byte session token in every POST form, compared with hash_equalsincludes/auth.php, all POST forms
Brute-force loginArithmetic CAPTCHA plus lockout after 5 failed attempts per username, or 20 failed attempts per IP address, within 15 minutesauth/login.php, includes/functions.php, table login_attempts
Username enumerationGeneric login error and dummy password verification for unknown usernamesauth/login.php
Weak password storagepassword_hash with PASSWORD_DEFAULT; automatic re-hash when the algorithm changes; no plain text or MD5auth/register.php, auth/settings.php, create_admin.php, auth/login.php
Weak passwordsMinimum 8 characters with at least one letter and one number on registrationauth/register.php
Session hijacking and fixationHttpOnly, SameSite, strict mode, secure flag on HTTPS, regeneration at login, idle timeoutincludes/auth.php, auth/login.php
ClickjackingX-Frame-Options DENY and CSP frame-ancestors noneincludes/functions.php
MIME sniffing and information leakageX-Content-Type-Options nosniff, Referrer-Policy, Permissions-Policyincludes/functions.php
Data in transitStrict-Transport-Security header on HTTPS and optional redirect to HTTPS controlled by FORCE_HTTPSincludes/functions.php, config/config.php
Directory listingOptions -Indexes.htaccess
Privilege escalationrequire_role() on every protected page; role never accepted from a formincludes/auth.php, all protected pages
Respondent privacySurvey text answers are shown to admins without namesadmin/survey_results.php
Insecure access to backups (Planned)Backups stored outside the web folder and served only through an admin-only pagePlanned with the backup module

9. Audit Trail Design

9.1 Table structure

Audit entries are stored in the activity_logs table (see Section 5.8). Each entry stores the user, role, action, details, IP address, browser, and a timestamp that holds both the date and the time.

9.2 Recording function

log_activity() in includes/functions.php inserts one row using the current session user. It is wrapped so that a logging failure is written to the server error log and never breaks the page.

9.3 Actions recorded today

ActionRecorded whenFile
LOGIN_SUCCESSA user logs in successfullyauth/login.php
LOGIN_FAILEDA login attempt failsauth/login.php
LOGIN_LOCKEDA login is refused because of the lockoutauth/login.php
LOGOUTA user logs outauth/logout.php
REGISTERAn athlete registersauth/register.php
PROFILE_UPDATEA user updates the profileauth/settings.php
PASSWORD_CHANGEA user changes the passwordauth/settings.php

9.4 Planned audit coverage

Planned: record every create, update, and delete of schedule items, time logs, tasks, athletes, and survey submissions, CSV exports, and backup actions, and add an administrator page to view, filter, print, and export the log.

9.5 Rules

  • Passwords, password hashes, tokens, and CAPTCHA answers are never written to the log.
  • The application has no function to edit or delete log entries.

10. Backup and Restore Design

Status: Planned. The configuration constants BACKUP_DIR and BACKUP_KEEP already exist in config/config.php, but no backup page or script has been built yet. The design below is the intended implementation.

TopicDesign
Backup typesDatabase backup (.sql), files backup (.zip), and full backup (database plus files).
Database dumpGenerated in PHP through PDO: DROP TABLE, SHOW CREATE TABLE, and batched INSERT statements. The generated column time_logs.hours is excluded from the INSERT statements. Views are included.
File backupZipArchive of the project folder, excluding the backup folder and log files.
File namingtmcacsa_{db|files|full}_{date}_{time}_{random}.{sql|zip}
Storage locationBACKUP_DIR, a folder outside the public web folder.
DownloadOnly through an admin-only page that validates the file name; never by direct link.
RetentionThe newest BACKUP_KEEP backups are kept per type.
Scheduled backupA command-line script run by cron weekly (daily for transaction-heavy use) that creates a full backup.
Restore safeguardsAdmin password re-entry, a typed confirmation word, CSRF check, an automatic pre-restore backup, and zip-slip protection when extracting files.
AuditEvery backup, download, delete, and restore is recorded in activity_logs.

11. Page and Route Reference

URLMethodsAllowed rolesPurpose
/index.phpGETGuest (logged-in users are redirected)Landing page
/auth/login.phpGET, POSTGuestLog in
/auth/register.phpGET, POSTGuestRegister an athlete
/auth/logout.phpPOSTAthlete, AdminLog out
/auth/settings.phpGET, POSTAthlete, AdminProfile and password
/create_admin.phpGET, POSTGuest, only while no admin existsCreate the first admin
/athlete/dashboard.phpGETAthleteAthlete dashboard
/athlete/schedule.phpGET, POSTAthleteWeekly schedule
/athlete/timelog.phpGET, POSTAthleteTime log with filters and pagination
/athlete/tasks.phpGET, POSTAthleteTasks
/athlete/survey.phpGET, POSTAthleteSurvey
/admin/dashboard.phpGETAdminAdmin dashboard
/admin/athletes.phpGET, POSTAdminAthlete list, profile, delete
/admin/survey_results.phpGETAdminSurvey results
/admin/reports.phpGETAdminReports and CSV export (export=time_logs, survey_responses, athlete_summary)
/help/prd.phpGETEveryoneProduct Requirement Document
/help/trd.phpGETEveryoneTechnical Requirement Document

12. Input Validation and Error Handling

12.1 Validation rules

FormRules
RegistrationFull name, username, sport, year level, and course required. Username 4 to 30 characters using letters, numbers, and underscore, and unique. Email optional but must be valid when given. Password at least 8 characters with a letter and a number, and must match the confirmation. CAPTCHA required.
LoginUsername, password, and CAPTCHA required. Generic error messages.
ScheduleValid category, valid day, start and end time required, end time later than start time. Overlap produces a warning and the item is still saved.
Time logValid date, category, start and end time, end time later than start time. The hours column is calculated by MySQL.
TaskTitle required, due date must be a real date in Y-m-d format, priority and status must be one of the allowed values.
SurveyConsent checkbox required. Every Likert question must have an answer from 1 to 5.
Filters and idsGET values are validated (integers with FILTER_VALIDATE_INT, dates, allowed lists) and used only as bound parameters.

Validation runs on the server for every form. The data-validate attribute adds extra checks in the browser through main.js, but the server never relies on them.

12.2 Error handling

  • Validation errors and results are shown as flash messages.
  • Successful changes use Post/Redirect/Get so refreshing the page does not repeat the action.
  • In production (APP_ENV set to production) display_errors is turned off and log_errors is turned on.
  • A failed database connection throws an exception from config/db.php. A friendlier production error page is a planned improvement.

13. Reports, Filtering, and Print Design

13.1 Filters

PageFilters
athlete/timelog.phpDate from, date to, category, page number
athlete/tasks.phpStatus
admin/athletes.phpSearch text, sport, year level
admin/reports.phpSport, year level, date from, date to

13.2 Reports and exports

admin/reports.php shows filtered data and offers three CSV exports: time logs, survey responses, and athlete summary. The export is a GET request with an allowed-list check on the export parameter. The file is sent with a text/csv content type, a dated file name, and a UTF-8 byte order mark so Excel opens it correctly.

13.3 Print design

The stylesheet contains @media print rules, and the header supports a print mode through the print=1 query string that hides the sidebar and navigation. The two Help documents have a Print / Save as PDF button (data-print) and a Copy content button. Planned: a Print Preview button on every report page and a personal report page for athletes.

14. Deployment and Environment Requirements

14.1 Server requirements

ItemRequirement
PHP8.0 or newer
PHP extensionspdo_mysql and mbstring. The zip extension is needed for the planned file backup.
MySQL8.0 or newer, utf8mb4
Web serverPHP built-in server for development; Apache for hosting (the .htaccess file is for Apache)
BrowserCurrent Chrome, Safari, Firefox, or Edge, on desktop or phone
NetworkInternet access to load Chart.js from cdn.jsdelivr.net

14.2 Configuration (names and meaning only)

NameMeaning
APP_NAMEApplication name shown in pages
BASE_URLURL prefix for links. Empty when served from the web root.
APP_ENVdevelopment or production
FORCE_HTTPSWhen true, HTTP requests are redirected to HTTPS
SESSION_IDLE_MINUTESIdle time before automatic logout
LOGIN_MAX_ATTEMPTSFailed logins allowed before lockout
LOGIN_LOCKOUT_MINUTESLength of the lockout window
BACKUP_DIR, BACKUP_KEEPBackup folder and number of backups to keep (backup module is planned)
DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS, DB_CHARSETDatabase connection settings in config/db.php

14.3 Production deployment checklist

  1. Create a domain or subdomain in the hosting panel and upload the project files.
  2. Create a database and a dedicated database user, then import the database scripts.
  3. Edit config/db.php with the hosting credentials and use a strong password.
  4. Set APP_ENV to production and set BASE_URL for the install location.
  5. Install an SSL certificate, then set FORCE_HTTPS to true.
  6. Create the admin account with create_admin.php, then delete that file.
  7. Confirm directory listing is disabled and that errors are not displayed to visitors.
  8. Test login, CAPTCHA, lockout, every module, and the phone layout over HTTPS.

15. Testing Strategy and Test Cases

Testing is manual and functional, done in the browser on a desktop and on a phone, with one athlete account and one admin account. Database results are confirmed in MySQL Workbench.

IDScenarioStepsExpected result
TC-01Register an athleteOpen Register, fill all fields, answer the CAPTCHA, submitAccount is created and the user is sent to Login
TC-02Duplicate usernameRegister again with the same usernameError says the username is taken
TC-03Weak passwordRegister with a password of 6 charactersValidation error is shown
TC-04Correct loginLog in with valid credentials and the correct CAPTCHARedirected to the dashboard for the role
TC-05Wrong CAPTCHALog in with a wrong CAPTCHA answerMessage Incorrect CAPTCHA answer; no login
TC-06Wrong passwordLog in with a wrong passwordGeneric Invalid username or password message
TC-07LockoutFail login 5 times for one usernameLockout message with remaining minutes
TC-08LogoutClick Logout in the profile menuSession ends and Login page is shown
TC-09Idle timeoutStay idle longer than the timeout and reloadSession-expired message and login page
TC-10Role protectionLogged in as athlete, open an admin URLAccess is blocked with an error message
TC-11Guest protectionLogged out, open a dashboard URLRedirected to Login
TC-12Add time logEnter a valid log and submitRow appears and hours are calculated
TC-13Invalid time rangeEnter an end time earlier than the start timeValidation error; nothing saved
TC-14Edit and delete time logEdit a log, then delete it with confirmationChanges saved; row removed after confirmation
TC-15Time log filter and paginationFilter by date and category; create more than 10 logsOnly matching rows appear; pagination works
TC-16Schedule overlapAdd two overlapping items on one dayWarning is shown and both are saved
TC-17TasksAdd a task with a past due dateTask is marked Overdue until set to Done
TC-18SurveySubmit without consent, then with consent and all Likert answersFirst is rejected; second saves; reopening shows saved answers
TC-19OwnershipTry to edit another athlete record by changing the id in the URLRecord is not shown or changed
TC-20Admin dashboardLog in as admin with data presentStatistics, charts, and overload table appear
TC-21Athlete search and deleteSearch an athlete, then delete with confirmationAthlete and related records are removed
TC-22CSV exportApply a filter and export time logsCSV downloads and opens correctly in Excel
TC-23Audit entriesLog in, fail a login, and log out; query activity_logsRows exist for each action with date and time
TC-24Phone layoutOpen the site on a phoneMenu drawer works, no sideways scrolling, tables are readable
TC-25Print Help documentOpen a Help page and use Print / Save as PDFClean A4 output without the sidebar

16. Performance Considerations

  • Indexes on (user_id, log_date), (user_id, due_date), and the audit and login attempt columns support the most common filters.
  • The time log list is paginated with 10 rows per page using LIMIT and OFFSET.
  • Totals and averages are calculated in SQL (SUM, AVG, COUNT, GROUP BY) rather than in PHP loops.
  • The hours value is a stored generated column, so it is not recalculated for every report.
  • Old login attempts are deleted automatically after one day.
  • The interface uses one stylesheet and two small scripts, and has no image-heavy assets.

17. Known Limitations and Future Enhancements

ItemDescription
Audit coverageOnly authentication, registration, profile, and password events are recorded. Data changes are not yet logged.
Activity log pageThere is no administrator page to view or export the audit trail yet.
Backup and restoreNot yet built. Only the configuration constants exist.
Report print previewReport pages have no print preview button yet, and athletes have no personal report page.
Admin athlete managementAdministrators can search, view, and delete athletes. Adding and editing athletes from the admin page is planned.
Chart.js versionChart.js is loaded from the CDN without a pinned version. Pinning an exact version is recommended before deployment.
Database credentialsStored in config/db.php. For hosting, use a dedicated database user and keep the file out of version control.
Database error pageA failed connection raises an exception. A friendly production error page is planned.
Help documentsThe PRD and TRD pages are public. They can be restricted to administrators after the project is graded.
HTTPSSupported through FORCE_HTTPS but disabled during local development.
Future ideasPassword reset, email notifications, calendar sync, coach accounts per team, and data visualizations by sport.

18. Current Implementation Status

Module or featureStatusNotes
Registration, login, logout, sessions, CAPTCHA, lockoutImplementedArithmetic CAPTCHA, 5-attempt lockout, CSRF, idle timeout.
Password hashingImplementedpassword_hash with automatic re-hash.
Settings (profile and password)Implementedauth/settings.php
Weekly scheduleImplementedCreate, view, delete, overlap warning.
Time logImplementedCreate, view, edit, delete, filter, paginate.
TasksImplementedCreate, view, edit, status change, delete, filter.
SurveyImplementedConsent, Likert and text questions, update answers.
Athlete dashboardImplementedCards, charts, tasks, schedule, balance alert.
Admin dashboardImplementedCards, chart, overload table.
Admin athlete managementIn progressSearch, filters, profile, and delete are done; add and edit are planned.
Survey resultsImplementedAnonymous averages, distributions, text answers.
Reports and CSV exportImplementedThree filtered CSV exports.
Report print preview and athlete personal reportPlannedMenu link already guarded by file_exists.
Audit trail recordingIn progressAuthentication, registration, profile, and password events recorded; data changes planned.
Activity log viewerPlannedAdmin page to filter, print, and export logs.
Backup and restorePlannedConfiguration constants exist; no page or script yet.
Responsive phone layoutImplementedSidebar drawer, stacked tables, touch-friendly controls.
HTTPS and domain deploymentIn progressFORCE_HTTPS available but off; no production domain configured yet.
Product and Technical Requirement DocumentsImplementedhelp/prd.php and help/trd.php