More bugfixes

This commit is contained in:
Pinga 2024-11-23 15:42:47 +02:00
parent abde99e73e
commit 439995baaf
5 changed files with 27 additions and 21 deletions

View file

@ -640,10 +640,6 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
}
}
$parts = extractDomainAndTLD($domainName);
$label = $parts['domain'];
$domain_extension = $parts['tld'];
$invalid_domain = validate_label($domainName, $db);
if ($invalid_domain) {
@ -651,6 +647,10 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
return;
}
$parts = extractDomainAndTLD($domainName);
$label = $parts['domain'];
$domain_extension = $parts['tld'];
$valid_tld = false;
$stmt = $db->prepare("SELECT id, tld FROM domain_tld");
$stmt->execute();

View file

@ -191,6 +191,9 @@ function validate_label($label, $pdo) {
if (strlen($label) < 2) {
return 'Total length of your domain must be greater then 2 characters';
}
if (strpos($label, '.') === false) {
return 'Invalid domain name format, must contain at least one dot (.)';
}
if (strpos($label, 'xn--') === false && preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $label)) {
return 'Invalid domain name format, cannot begin or end with a hyphen (-)';
}