27 lines
636 B
PHP
27 lines
636 B
PHP
<?php
|
|
|
|
function regGetUpperDomain($domain) {
|
|
// Remove anything before the first dot and the first dot itself
|
|
return preg_replace("/^[^.]+\./", "", $domain);
|
|
}
|
|
|
|
function regListUserDomains($username) {
|
|
return query('select', 'registry', ['username' => $username], 'domain');
|
|
}
|
|
|
|
function regCheckDomainPossession($domain) {
|
|
checkAbsoluteDomainFormat($domain);
|
|
|
|
$ownedDomains = regListUserDomains($_SESSION['username']);
|
|
|
|
if (in_array($domain, $ownedDomains, true) !== true)
|
|
userError("You don't own this domain.");
|
|
}
|
|
|
|
function regIsFree($domain) {
|
|
foreach (query('select', 'registry', ['domain' => $domain], 'domain')) {
|
|
|
|
}
|
|
|
|
}
|