Skip to content

Instantly share code, notes, and snippets.

@bernard-ng
Created December 23, 2020 13:54
Show Gist options
  • Save bernard-ng/ad5fa5bc7ef2c6045a9b3c586464d5df to your computer and use it in GitHub Desktop.
Save bernard-ng/ad5fa5bc7ef2c6045a9b3c586464d5df to your computer and use it in GitHub Desktop.
<?php
function validRequest(): bool {
$myDomain = $_SERVER['SCRIPT_URI'];
$requestsSource = $_SERVER['HTTP_REFERER'];
return parse_url($myDomain, PHP_URL_HOST) === parse_url($requestsSource, PHP_URL_HOST);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment