PHP code example of onedrop / restrictedfiles
1. Go to this page and download the library: Download onedrop/restrictedfiles library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onedrop / restrictedfiles example snippets
public function redirectToReferer(PersistentResource $resource, HttpRequest $httpRequest)
{
$referer = $httpRequest->getHeader('Referer');
if (!empty($referer)) {
$refererUri = new Uri($referer);
if ($refererUri->getHost() === $httpRequest->getUri()->getHost()) {
$refererUri->setQuery('--restricted-files[accessDenied]=true');
header('Location: ' . $refererUri->__toString());
exit();
}
}
}