mirror of
https://github.com/pi-hole/web.git
synced 2025-12-22 19:58:27 +00:00
23 lines
530 B
PHP
23 lines
530 B
PHP
<?php
|
|
|
|
function is_valid_domain_name($domain_name)
|
|
{
|
|
return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) && //valid chars check
|
|
preg_match("/^.{1,253}$/", $domain_name) && //overall length check
|
|
preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name)); //length of each label
|
|
}
|
|
|
|
function checkfile($filename) {
|
|
if(is_readable($filename))
|
|
{
|
|
return $filename;
|
|
}
|
|
else
|
|
{
|
|
// substitute dummy file
|
|
return "/dev/null";
|
|
}
|
|
}
|
|
|
|
?>
|