mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
add domain-validator
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
c646507c60
commit
f00aaf14cd
3 changed files with 30 additions and 6 deletions
17
php/domain-validator.php
Normal file
17
php/domain-validator.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$domain = $_GET['domain'] ?? '';
|
||||
|
||||
if (strpos($domain, '.') === false) {
|
||||
http_response_code(400);
|
||||
} elseif (strpos($domain, '/') !== false) {
|
||||
http_response_code(400);
|
||||
} elseif (strpos($domain, ':') !== false) {
|
||||
http_response_code(400);
|
||||
} elseif (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
||||
http_response_code(400);
|
||||
} elseif (filter_var($domain, FILTER_VALIDATE_IP)) {
|
||||
http_response_code(400);
|
||||
} else {
|
||||
http_response_code(200);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue