2021-02-17 22:48:49 +01:00
|
|
|
<?php
|
|
|
|
|
2021-07-15 15:36:34 +02:00
|
|
|
function regGetUpperDomain($domain) {
|
2022-04-18 16:05:00 +02:00
|
|
|
// Remove anything before the first dot and the first dot itself
|
|
|
|
return preg_replace("/^[^.]+\./", "", $domain);
|
2021-02-19 13:23:26 +01:00
|
|
|
}
|
|
|
|
|
2021-02-18 22:40:16 +01:00
|
|
|
function regListUserDomains($username) {
|
2022-06-12 01:31:16 +02:00
|
|
|
return query('select', 'registry', ['username' => $username], 'domain');
|
2021-02-18 22:40:16 +01:00
|
|
|
}
|
|
|
|
|
2021-02-19 13:23:26 +01:00
|
|
|
function regCheckDomainPossession($domain) {
|
2022-04-18 16:05:00 +02:00
|
|
|
checkAbsoluteDomainFormat($domain);
|
2021-02-18 22:40:16 +01:00
|
|
|
|
2022-05-23 04:41:55 +02:00
|
|
|
$ownedDomains = regListUserDomains($_SESSION['username']);
|
2021-02-18 22:40:16 +01:00
|
|
|
|
2022-05-23 04:41:55 +02:00
|
|
|
if (in_array($domain, $ownedDomains, true) !== true)
|
2022-05-20 02:19:45 +02:00
|
|
|
userError("You don't own this domain.");
|
2021-02-18 22:40:16 +01:00
|
|
|
}
|
|
|
|
|
2021-02-19 13:23:26 +01:00
|
|
|
function regIsFree($domain) {
|
2022-06-12 01:31:16 +02:00
|
|
|
foreach (query('select', 'registry', ['domain' => $domain], 'domain')) {
|
2021-02-17 22:48:49 +01:00
|
|
|
|
2022-04-18 16:05:00 +02:00
|
|
|
}
|
2021-02-17 22:48:49 +01:00
|
|
|
|
|
|
|
}
|