You can call your own authentication function to validate users before they access Monsta FTP (for example, requiring users to come from your control panel instead of directly using the Monsta FTP login form).
On page load, Monsta FTP checks for a file called mftp_extensions.php (in the same directory as index.php) and includes it if it exists.
If the function mftpInitialLoadValidation is defined, Monsta FTP calls it during initial page load:
mftpInitialLoadValidation($isMonstaPostEntry: bool) -> bool
$isMonstaPostEntry is true only when the request method is POST and MFTP_POST is set to 'true'. See How to log in from an external form for POST login usage.
If mftpInitialLoadValidation() returns false, script execution stops immediately and no page output is displayed. Example:
Another example:
All PHP globals are available in this function (for example: $_GET, $_POST, $_SERVER), so you can implement any validation logic you need.