Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions no.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ function getRequestHeaders($multipart_delimiter=NULL) {

function build_domain_regex($hostname)
{
if (filter_var($hostname, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
return $hostname;
}
$names = explode('.', $hostname); //assumes main domain is the TLD
if (count($names) === 1) {
return $hostname;
}

$regex = "";
for ($i= 0; $i < count ($names)-2; $i++)
{
Expand Down