servnest/inc/reg.inc.php
2021-02-18 22:40:16 +01:00

170 lines
3.2 KiB
PHP

<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
function regListUserDomains($username) {
$db = new PDO('sqlite:' . DB_PATH);
$usernameArray[0] = $username;
$op = $db->prepare('SELECT domain FROM registry WHERE username = ?');
$op->execute($usernameArray);
$domains = false;
$domain = $op->fetch()['domain'];
$i = 0;
while ($domain != NULL) {
$domains[$i] = $domain;
$domain = $op->fetch()['domain'];
$i++;
}
return $domains;
}
function nicCheckDomainPossession($domain) {
checkAbsoluteDomainFormat($domain);
$db = new PDO('sqlite:' . DB_PATH);
$username[0] = $_SESSION['username'];
$op = $db->prepare('SELECT domain FROM registry WHERE username = ?');
$op->execute($username);
$dbDomain = $op->fetch()['domain'];
$owned = false;
while ($dbDomain != NULL) {
if ($dbDomain == $domain) {
$owned = true;
break;
}
$dbDomain = $op->fetch()['domain'];
}
if (!($owned === true))
exit("Erreur : Vous ne possédez pas ce domaine sur le registre !");
}
function isFree($domain) {
$domainArray[0] = $domain;
$db = new PDO('sqlite:' . DB_PATH);
$req = $db->prepare('SELECT domain FROM registry WHERE domain = ?');
$req->execute($domainArray);
$domainFound = $req->fetch()['domain'];
if (isset($domainFound)) {
return false;
} else {
return true;
}
}
$suffixes = array(
"atope.art.",
"asso.atope.art.",
"org.atope.art.",
"perso.atope.art.",
"blog.atope.art.",
"me.atope.art.",
"edu.atope.art.",
"info.atope.art.",
"wiki.atope.art.",
"sci.atope.art.",
"pol.atope.art.",
"libre.atope.art.",
"fem.atope.art.",
"eco.atope.art.",
"veg.atope.art.",
"bio.atope.art.",
"anar.atope.art.",
"ancom.atope.art.",
"acab.atope.art.",
"handi.atope.art.",
"queer.atope.art.",
"gay.atope.art.",
"enby.atope.art.",
"trans.atope.art.",
"net.atope.art.",
"tech.atope.art.",
"io.atope.art.",
"sec.atope.art.",
"cyber.atope.art.",
"dev.atope.art.",
"geek.atope.art.",
"fs.atope.art.",
"ht.atope.art.",
"hyper.atope.art.",
"git.atope.art.",
"forge.atope.art.",
"code.atope.art.",
"lab.atope.art.",
"labs.atope.art.",
"gemini.atope.art.",
"gmi.atope.art.",
"gemlog.atope.art.",
"mail.atope.art.",
"ynh.atope.art.",
"yuno.atope.art.",
"sys.atope.art.",
"fed.atope.art.",
"fedi.atope.art.",
"soc.atope.art.",
"masto.atope.art.",
"plero.atope.art.",
"pix.atope.art.",
"mobi.atope.art.",
"art.atope.art.",
"music.atope.art.",
"video.atope.art.",
"draw.atope.art.",
"audio.atope.art.",
"ink.atope.art.",
"na.atope.art.",
"psy.atope.art.",
"neuro.atope.art.",
"auti.atope.art.",
"plur.atope.art.",
"blue.atope.art.",
"red.atope.art.",
"pink.atope.art.",
"green.atope.art.",
"black.atope.art.",
"city.atope.art.",
"town.atope.art.",
"cafe.atope.art.",
"home.atope.art.",
"forum.atope.art.",
"dream.atope.art.",
"space.atope.art.",
"forest.atope.art.",
"rain.atope.art.",
"snow.atope.art.",
"sun.atope.art.",
"earth.atope.art.",
"world.atope.art.",
"soft.atope.art.",
"cute.atope.art.",
"cutie.atope.art.",
"fun.atope.art.",
"play.atope.art.",
"game.atope.art.",
);