0

I have an application that will run on other domains. The application needs to check if an email address matches the domain of the site running the application.

So, if email = fred@example.com ,

  • if application is running on example.com , return true
  • if application is running on anything.example.com, return true
  • if application is running on domain.com, return false

I understand that the $_SERVER variables might be incorrect due to spoofing. So what is the best way for the server running the application to get the server's domain name?

Rick Hellewell
  • 1,032
  • 11
  • 34
  • Does this answer your question? [Get current domain](https://stackoverflow.com/questions/10717249/get-current-domain) – user3783243 Jul 29 '22 at 18:07
  • No, because the SERVER variables listed in there are not secure, and not always available. See one of the answers in that link: https://stackoverflow.com/a/50301646/1466973 . – Rick Hellewell Jul 29 '22 at 18:46
  • I guess the question is more towards this in that case, https://stackoverflow.com/questions/1459739/php-serverhttp-host-vs-serverserver-name-am-i-understanding-the-ma I wouldn't trust `HTTP_*` values. – user3783243 Jul 29 '22 at 19:16

0 Answers0