servnest/inc/reg.inc.php

180 lines
3.4 KiB
PHP
Raw Normal View History

2021-02-17 21:48:49 +00:00
<?php
if (strpos($_SERVER['PHP_SELF'], "inc.php") !== false)
exit("This file is meant to be included.");
2021-02-19 12:23:26 +00:00
function regGetSuffix($domain) {
return preg_replace("/^[^.]+\./", "", $domain);
}
2021-02-18 21:40:16 +00:00
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;
$i = 0;
$data = $op->fetch();
$domain = $data['domain'];
2021-02-18 21:40:16 +00:00
while ($domain != NULL) {
$domains[$i] = $domain;
$data = $op->fetch();
if (isset($data['domain']))
$domain = $data['domain'];
else
$domain = NULL;
2021-02-18 21:40:16 +00:00
$i++;
}
return $domains;
}
2021-02-19 12:23:26 +00:00
function regCheckDomainPossession($domain) {
2021-02-18 21:40:16 +00:00
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) {
2021-02-19 12:23:26 +00:00
if ($dbDomain === $domain) {
2021-02-18 21:40:16 +00:00
$owned = true;
break;
}
$dbDomain = $op->fetch()['domain'];
}
if (!($owned === true))
exit("Erreur : Vous ne possédez pas ce domaine sur le registre !");
}
2021-02-19 12:23:26 +00:00
function regIsFree($domain) {
2021-02-17 21:48:49 +00:00
$domainArray[0] = $domain;
$db = new PDO('sqlite:' . DB_PATH);
$req = $db->prepare('SELECT domain FROM registry WHERE domain = ?');
$req->execute($domainArray);
2021-05-14 19:10:56 +00:00
$data = $req->fetch();
2021-02-17 21:48:49 +00:00
2021-05-14 19:10:56 +00:00
if (isset($data['domain'])) {
2021-02-17 21:48:49 +00:00
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.",
);