# Authentication Module

## Installation
1. Place this folder as your site `/auth` directory.
2. Ensure `../constants/connection.php` creates a valid mysqli variable named `$conn`.
3. Ensure `../constants/websiteinfo.php` defines `$company` or define `COMPANY_NAME`.
4. Import `auth-required-schema.sql` if the verification columns/indexes are missing.
5. Configure `../constants/mailscript.php` to return `false` on failure and any other value on success.

## Changing colours
Edit only `auth-theme.css`. The `:root` section contains the brand and background RGB values used throughout the page. Keep values in the form `22 163 74`, not hex.

## Reliability changes
- Removed the accidental duplicate nested auth folder.
- Added database connection validation and UTF-8 setup.
- Removed dependency on mysqli `get_result()`.
- Added prepare/execute checks for registration queries.
- Corrected account balance bind types to strings, matching the supplied schema.
- Made both desktop and mobile logo initials derive from the company name.
- Kept CSRF validation, password hashing, transaction rollback, email verification expiry and session ID regeneration.

## Important production notes
- Tailwind and Google Fonts are loaded from CDNs. For a fully offline or strict-CSP deployment, compile Tailwind locally and self-host the font.
- PHP `mail()` often does not work on local WAMP without SMTP configuration. The supplied `constants/mailscript.php` is therefore the preferred delivery route.
- The included `sql.php` is a full database dump containing sample/user data. Do not publish it inside a web-accessible folder. Store database backups outside the document root.
