LCPL LAB SYSTEM Admin Guide

๐Ÿ›ก๏ธ For Administrators & Managers
The LCPL Lab System manages the full lifecycle of a lab report: a technician (Subordinate) uploads a batch of report files for a customer, a Manager or Admin reviews and approves or rejects the batch, and once approved, the system automatically emails the report files to the internal distribution list and the customer, then archives them.

Admin Guide โ€” Contents

1 Introduction

The LCPL Lab System manages the full lifecycle of a lab report: a technician (Subordinate) uploads a batch of report files for a customer, a Manager or Admin reviews and approves or rejects the batch, and once approved, the system automatically emails the report files to the internal distribution list and the customer, then archives them.

1.1 User roles

RoleWhat they can do
SubordinateUpload new report batches for a customer. Can see their own uploads and the read-only Report Archive.
ManagerEverything a Subordinate can see, plus: review pending batches and Approve or Reject them.
AdminEverything a Manager can do, plus: manage customers, the email distribution list, user accounts, permanently delete rejected files, and run one-off maintenance tools.
ViewerRead-only access to the Report Archive only. Cannot upload or approve anything.

1.2 The report lifecycle

Pending โ†’ Approved โ†’ Sent โ†’ Archived
๐Ÿ“Œ Note

Approval and email delivery are two separate, independent steps. A batch can sit in "Approved" for a short time before flipping to "Sent" โ€” this is normal and is explained in Section 6.

2 Logging In & Accounts

Open the system's web address in a browser and sign in with the email and password your Admin gave you.

2.1 Forced password change

When an Admin creates a new account, or explicitly flags an existing one, the user is required to set a new password immediately after logging in โ€” a dialog appears automatically and cannot be dismissed until a new password (minimum 6 characters) is set.

๐Ÿ“Œ Note

There is currently no self-service "change my password anytime" option for regular users. If someone needs to change their password outside of this forced flow, an Admin must reset it for them from the Users page (Section 5) or the password reset tool (Section 9.2).

3 Uploading Reports (Subordinate)

Any Subordinate account can upload a new batch of report files from the Upload Report page.

1
Click "Upload Report"

In the sidebar.

2
Enter a Report Title

E.g. "Batch #405 Analysis". If you upload multiple files, each file's name is automatically appended to this title so they stay distinguishable.

3
Select the Customer

Choose from the dropdown of existing customers.

4
Add a description or remarks (optional)

Useful context for the approving Manager, e.g. batch details or test parameters.

5
Attach one or more files

Drag and drop, or click to browse. Accepted formats: PDF, DOC/DOCX, XLS/XLSX, JPG, PNG. Maximum 20MB per file.

6
Click "Upload & Notify Manager"

All files in this submission are grouped into a single batch and set to Pending.

๐Ÿ“Œ Note

Uploading does not send an email immediately. It queues a notification that a background process delivers shortly afterward โ€” see Section 6 for why this matters.

4 Reviewing Approvals (Manager / Admin)

Manager and Admin accounts see an Approvals link in the sidebar, with a red badge showing how many batches are waiting.

1
Open Approvals

Every pending batch is listed with its title, description, customer, and file count.

2
Review the batch

Use the description/remarks column for context from the uploader.

3
Click Approve or Reject

Both actions take effect immediately.

4.1 What happens after you Approve

The batch status changes to Approved right away. An email notification is queued for delivery (see Section 6) containing the report files as attachments, sent to the internal distribution list and CC'd to the customer's own email address (if one is on file) and to the designated senior recipient. Once that email is actually sent, the status automatically flips to Sent and the batch appears in the Report Archive.

4.2 What happens after you Reject

The batch status changes to Rejected. No email is sent. The batch (and its files) moves into Rejected Files, visible only to Admin, where it stays until an Admin permanently deletes it (Section 8). Add a clear remark when rejecting โ€” it is shown to the Admin reviewing Rejected Files.

5 Managing Users (Admin)

Go to Users to create, edit, or remove accounts.

1
Click "Create New User"

Or "Edit" next to an existing user.

2
Fill in name, email, and password

When editing, leave the password field blank to keep the current password unchanged.

3
Choose a role

Subordinate, Manager, Admin, or Viewer โ€” see Section 1.1.

4
Optionally tick "Force Password Change on Next Login"

New users always have this set automatically.

5
Save

The user can now log in with the credentials you set.

๐Ÿ“Œ Note

You cannot delete your own currently logged-in account, and you cannot delete a user who has uploaded reports โ€” the system will tell you to delete their reports first. This protects the audit trail.

6 How Email Notifications Work

This is the most important operational concept in the system to understand, because of a past incident that shaped how it works today.

6.1 Background history: why this is a queue, not instant email

Earlier versions of this system tried to send email while the user waited for the Upload or Approve page to finish loading. When the SMTP mail server became slow or unreachable, each of those page requests could hang for up to five minutes. Hostinger shared hosting limits how many PHP processes an account may run at once; a handful of these hung requests exhausted that limit and took the entire site offline for every user โ€” even ones just trying to log in.

๐Ÿ’ก Tip

The system was redesigned specifically to prevent this from happening again. Uploading a report and approving a batch are now instant, database-only actions. A separate background process is the only thing that ever talks to the mail server, and it runs completely outside of any user's request.

6.2 The queue in practice

1
An action happens

A report is uploaded, or a batch is approved. This queues an email job in the database โ€” a fast write, not a network call.

2
The background worker runs

A scheduled task (cron job) runs send_queue.php roughly once a minute, picks up any due jobs, and actually sends the email via SMTP.

3
Status updates automatically

On success, the queued job is marked sent, and for approval emails, the report batch itself flips from Approved to Sent.

4
Failures retry automatically

If SMTP is temporarily down, a failed attempt is retried later with increasing delays (2, 4, 8, 16 minutes, and so on), up to a configured maximum number of attempts, without any manual action needed.

6.3 Confirming the cron job is set up

This background sending only works if a Cron Job has been configured on the server to run send_queue.php automatically. If it has not been set up (or was removed), emails will queue up but never actually send.

  1. Go to hPanel โ†’ Advanced โ†’ Cron Jobs in Hostinger.
  2. Confirm a job exists for send_queue.php. Recommended frequency: every 1 minute (or every 5 minutes, whichever is the finest interval your plan allows).
  3. Check the command path. It should look like: php /home/USERNAME/public_html/send_queue.php โ€” hPanel shows you the exact path for your account.
  4. If it's missing, create it using the settings above.
๐Ÿ’ก Tip

You can also trigger send_queue.php manually by visiting it in your browser while logged in as Admin โ€” useful for testing that email is working right now, without waiting for the next cron tick.

6.4 Diagnosing a stuck or failed email

If a batch stays "Approved" for a long time without becoming "Sent", or an uploader reports the manager was never notified:

7 Customers & the Email Distribution List

7.1 Managing customers

Go to Customers (Admin only) to add, edit, or remove the companies that reports are uploaded against. Every uploaded report must be linked to a customer.

โš ๏ธ Important

The Customer form currently only captures a company name โ€” there is no field to set a customer's own contact email from this screen, even though the underlying system does support CC'ing a customer on their own approved report if an email address is present on their record. If a customer needs to be CC'd automatically, their email currently has to be set directly in the customers table via phpMyAdmin. Worth asking your developer to restore this field to the form if customer CC's are something you rely on.

A customer cannot be deleted while they still have reports in the system โ€” delete or reassign their reports first.

7.2 Managing the internal distribution list

Go to Email List (Admin only) to manage who receives every approved report internally, regardless of customer. Add a name and email, and it will be CC'd/TO'd on every future approval notification. Edit or remove entries at any time โ€” changes apply to future approvals only, not ones already sent.

๐Ÿ“Œ Note

If the distribution list is empty, approval emails fall back to a single designated recipient configured by your developer in the mail settings, so reports are never silently lost.

8 Report Archive & Rejected Files

8.1 Report Archive (New)

Every Approved or Sent report is visible here, grouped by year and month, to every logged-in user regardless of role or which customer the report belongs to. Anyone can view/download a file; only Admin can permanently delete one.

๐Ÿ“Œ Note

This means any employee with a login โ€” not just people working with a specific customer โ€” can browse every approved report in the archive. If that is broader access than intended, this would need to be restricted in the code (e.g. by department or customer assignment).

8.2 Report Archive (Old)

A link to a previous, separate archive system is kept in the sidebar for continuity while historical data is being consolidated. It opens in a new tab and is unrelated to this system's database.

8.3 Rejected Files (Admin)

Rejected batches remain here, along with the rejection remarks, until an Admin permanently deletes them. Deleting removes both the database record and the underlying file from the server โ€” this cannot be undone.

9 Admin Maintenance Tools

9.1 Importing legacy data (one-time)

If historical report files exist outside the system (e.g. from before it was built), they can be bulk imported using the legacy importer.

1
Arrange files by year and month

Create a folder structure of legacy_data/YEAR/MONTH/ containing the files, uploaded to the server alongside the application.

2
Log in as Admin and visit the importer

It automatically creates a "Legacy Archive" customer to file these under, if one doesn't already exist.

3
Review the output

Each imported file is listed as it's processed; already-imported files (matched by path) are skipped automatically, so it is safe to run more than once.

๐Ÿ“Œ Note

Legacy Archive reports are deliberately excluded from the main dashboard counts, the Upload page's customer list, and Report Archive counts, so they don't skew day-to-day operational figures.

9.2 Resetting a single user's password

If someone is locked out and cannot use the forced-change flow themselves, an Admin can generate a fresh one-time password for exactly one account: select the user, confirm the action, and a random temporary password is generated and shown once on screen for you to share with them securely. It automatically forces them to set their own password on next login.

9.3 SMTP test tool

An Admin-only tool exists to send a test email using the live mail configuration, useful for confirming SMTP credentials are correct after a password rotation, without needing to wait for a real report to go through the approval flow.

10 Critical: Server Cleanup Required

โš ๏ธ Caution

This section reports specific findings from a review of the files provided for this guide. Please action these before relying on this system for anything sensitive.

10.1 Files to delete immediately

The following files were found alongside the current application. Each is an old, one-off patch or debug script that was superseded by a safer version, but was apparently left on the server rather than removed. If any of these still exist on your live site, delete them now:

FileWhy it must be deleted
22aug_fix_login.phpSEVERE: requires no login at all. Anyone who visits this URL resets every single user's password (including all Admin accounts) to the fixed value "123456". This is a complete, unauthenticated account-takeover path.
22aug_debug_email.phpSEVERE: requires no login. Hardcodes the live SMTP mailbox password in plain text and, when run, can print the raw SMTP handshake to the page โ€” exposing mail credentials to anyone who finds the URL.
22aug_process_action.php / bcc_process_action.phpOlder duplicates of the approval handler that still send email synchronously while the page waits โ€” the exact defect that caused the site-wide outage described in Section 6. Properly access-controlled, but should not exist alongside the fixed version.
22aug_upload_report.phpOlder duplicate of the upload handler with the same blocking-email defect as above.
remove_hostory_from_dashboard.phpAn older duplicate of the dashboard page. Properly access-controlled, but redundant and confusing to keep.
view_reports.phpAn older "History" page no longer linked from the sidebar, superseded by Report Archive. Not a security issue by itself, but safe to remove once confirmed unused, to avoid confusion.

10.2 Rotate these credentials

Because the two files above expose them without authentication, treat the following as already compromised and change them as soon as the files are deleted:

โš ๏ธ Important

This guide intentionally does not repeat the specific passwords found in the codebase. Treat any password that appears in a PHP file under the web root as already exposed and due for rotation.

10.3 File placement check

โš ๏ธ Caution

The background email sender (send_queue.php) expects two files at specific paths: config/mail.php (SMTP settings) and includes/mailer.php (shared mail setup code). Confirm both files actually live at those exact paths on your server, in their respective config/ and includes/ folders โ€” not sitting in the project's root folder. If they are in the wrong place, every background email send will fail with a fatal "file not found" error and no reports will ever be delivered, even though uploads and approvals will otherwise appear to work normally.

11 Frequently Asked Questions

A batch shows "Approved" but the customer says they never got the email. What happened?

This is expected for a short window โ€” approval and email delivery are separate steps (Section 6). If it has been more than a few minutes, check that the cron job is running (Section 6.3) and check the email_queue table for a failed job (Section 6.4).

Can I un-reject a batch?

Not directly through the interface. A rejected batch can only be permanently deleted by an Admin. If the rejection was a mistake, ask the Subordinate to re-upload the same files as a new batch.

Why can every employee see every customer's reports in the Archive?

That is how the Report Archive currently works โ€” it is not filtered by customer or department (Section 8.1). If your organization needs report visibility restricted, this would need a code change.

A customer isn't receiving a CC of their own reports. Why?

Most likely their email address was never set, since the Customer Management screen currently doesn't have a field for it (Section 7.1). It can be set directly via phpMyAdmin in the meantime.

What happens to the physical files when I delete a report?

Both the database record and the underlying file on the server are deleted together, from Dashboard, Report Archive, or Rejected Files. This cannot be undone โ€” there is no recycle bin.


LCPL LAB SYSTEM โ€” Admin Guide ยท All information is subject to change.