CALTEC ACADEMY MAKERERE – E-LEARNING PHP AUTHENTICATION PACKAGE

WHAT IS INCLUDED
- elearning.html and style1.css: your supplied page and styles, updated with uploader sign-in.
- script1.js: browser-side resource listing, searching, downloads, sign-in and upload handling.
- PHP/MySQL backend: individual accounts, password hashing, sessions, CSRF checks and server-side upload validation.
- admin-login.html and admin/: administrator sign-in and uploader account management.
- setup.php: one-time creation of the first administrator.
- sql/schema.sql: database tables.

REQUIREMENTS
- PHP 8.1+ with PDO MySQL, Fileinfo and mbstring extensions.
- MySQL 5.7+ or MariaDB equivalent.
- HTTPS enabled on the website.
- PHP upload_max_filesize and post_max_size set to at least 20M (post_max_size should be slightly higher, e.g. 22M).

INSTALLATION ON caltecacademy.com
1. Back up the current E-Learning page and files.
2. Create a MySQL database and database user in your hosting control panel. Grant the user full privileges on that database.
3. Import sql/schema.sql into the new database using phpMyAdmin.
4. Edit config.php and replace YOUR_DATABASE_NAME, YOUR_DATABASE_USER and YOUR_DATABASE_PASSWORD.
5. Upload the CONTENTS of this folder into the folder where the E-Learning page should live. Keep the api, admin, sql and storage folders in their locations. Ensure the PHP files are served by PHP, not downloaded as text.
6. Make storage writable by the PHP account (usually 750 or 770, depending on your hosting provider). The storage directory must not be directly accessible from the web. The included .htaccess denies direct access on Apache. For Nginx or other servers, configure a matching deny rule or move STORAGE_DIR in config.php to a directory outside public_html.
7. Visit https://YOUR-DOMAIN/YOUR-ELEARNING-FOLDER/setup.php. Create the first administrator. Use a strong unique password of at least 12 characters.
8. IMMEDIATELY delete setup.php from the server after creating the administrator.
9. Visit admin-login.html and sign in. Create one account for each authorised uploader. Give each uploader their own username and a unique password securely; do not publish passwords on the page.
10. Open elearning.html. Visitors can browse and download. Uploaders must sign in before the upload form appears.

ADMINISTRATION
- Administrator page: admin-login.html
- Create uploader accounts with unique usernames and passwords of at least 12 characters.
- Deactivate an uploader to prevent further authenticated actions. Existing sessions are also checked against the active account status.
- Use “Set password” to reset an uploader password.

IMPORTANT NOTES
- The original HTML referenced script1.js but that JavaScript file was not among the supplied attachments. This package supplies a replacement script1.js to connect the page to the PHP backend.
- Uploaded files are stored under random server-generated names; original filenames are only metadata. Downloads pass through download.php.
- The default maximum file size is 20 MB. Change MAX_UPLOAD_BYTES in config.php if required, and adjust PHP hosting limits too.
- The website's existing Bootstrap files, images, logo, libraries and js/main.js references are retained as in the supplied HTML. Keep those existing site assets available at the same relative paths.
- Test with a non-administrator uploader account before making the page public.
- Do not leave setup.php on the live server. Keep database credentials private and use HTTPS.
