signup improvements, user firewall block check.

This commit is contained in:
deepend 2025-09-29 20:08:34 +00:00
parent e3b2d04d0f
commit 7ba6e46df1
6 changed files with 304 additions and 167 deletions

5
.gitignore vendored
View File

@ -13,3 +13,8 @@ icons/
stats/
cache/
polls/polls.db
robots.txt
share/
polls/
botanygarden/
robots.txt

View File

@ -65,17 +65,17 @@ try {
// Create a default admin user with a hashed password
// NOTE: In production, you should not hardcode these credentials.
// Instead, store them outside of your code or set them up once.
$adminUsername = 'admin';
$adminPlainPassword = 'password'; // Change this in production
$adminHashedPassword = password_hash($adminPlainPassword, PASSWORD_DEFAULT);
// $adminUsername = 'admin';
// $adminPlainPassword = 'password'; // Change this in production
// $adminHashedPassword = password_hash($adminPlainPassword, PASSWORD_DEFAULT);
$insertUser = $db->prepare("
INSERT INTO users (username, password)
VALUES (:username, :password)
");
$insertUser->bindValue(':username', $adminUsername, PDO::PARAM_STR);
$insertUser->bindValue(':password', $adminHashedPassword, PDO::PARAM_STR);
$insertUser->execute();
// $insertUser = $db->prepare("
// INSERT INTO users (username, password)
// VALUES (:username, :password)
// ");
// $insertUser->bindValue(':username', $adminUsername, PDO::PARAM_STR);
// $insertUser->bindValue(':password', $adminHashedPassword, PDO::PARAM_STR);
// $insertUser->execute();
}
// Optionally, you can return $db or leave it globally accessible

View File

@ -1,91 +1,264 @@
User-Agent: MojeekBot
Allow: /~xwindows/
User-Agent: Qwantify
Allow: /~xwindows/
User-Agent: Wibybot
Allow: /~xwindows/
User-Agent: search.marginalia.nu
Allow: /~xwindows/
User-Agent: SearchMySiteBot
Allow: /~xwindows/
User-Agent: Duckduckbot
Allow: /~xwindows/
User-Agent: ia_archiver
Allow: /~xwindows/
User-Agent: Googlebot
Allow: /~xwindows/$
Allow: /~xwindows/index.html$
Disallow: /~xwindows/
User-Agent: bingbot
Allow: /~xwindows/$
Allow: /~xwindows/index.html$
Disallow: /~xwindows/
User-Agent: YandexBot
Allow: /~xwindows/$
Allow: /~xwindows/index.html$
Disallow: /~xwindows/
User-Agent: YandexFavicons
Disallow: /~xwindows/
User-Agent: MegaIndex.ru
Disallow: /~xwindows/
User-Agent: Amazonbot
Disallow: /~xwindows/
User-Agent: Linespider
Disallow: /~xwindows/
User-Agent: Bytespider
Disallow: /~xwindows/
User-Agent: CCBot
Disallow: /~xwindows/
User-Agent: Neevabot
Disallow: /~xwindows/
User-Agent: PetalBot
Disallow: /~xwindows/
User-Agent: SemrushBot
Disallow: /~xwindows/
User-Agent: AhrefsBot
Disallow: /~xwindows/
User-Agent: DataForSeoBot
Disallow: /~xwindows/
User-Agent: dotbot
Disallow: /~xwindows/
User-Agent: Barkrowler
Disallow: /~xwindows/
User-Agent: MJ12bot
Disallow: /~xwindows/
User-Agent: BuiltWith
Disallow: /~xwindows/
User-Agent: webprosbot
Disallow: /~xwindows/
User-Agent: Dataprovider
Disallow: /~xwindows/
User-Agent: *
Allow: /~xwindows/$
Allow: /~xwindows/index.html$
Disallow: /~xwindows/
user-agent:AwarioRssBot
disallow:/~bayang/
user-agent:YouBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:PerplexityBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:ImagesiftBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:search.marginalia.nu
allow:/~xwindows/
user-agent:Dataprovider
disallow:/~xwindows/
user-agent:ChatGPT-User
disallow:/~bayang/
disallow:/~jbd/
user-agent:Barkrowler
disallow:/~xwindows/
user-agent:peer39_crawler
disallow:/~bayang/
user-agent:ia_archiver
allow:/~xwindows/
user-agent:GTPBot
disallow:/~miccaman/
user-agent:magpie-crawler
disallow:/~bayang/
user-agent:Qwantify
allow:/~xwindows/
user-agent:GPTBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:ClaudeBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:YandexFavicons
disallow:/~xwindows/
user-agent:peer39_crawler/1.0
disallow:/~bayang/
user-agent:Linespider
disallow:/~xwindows/
user-agent:Applebot
disallow:/~bayang/
disallow:/~jbd/
user-agent:SearchMySiteBot
allow:/~xwindows/
user-agent:Duckduckbot
allow:/~xwindows/
user-agent:AwarioSmartBot
disallow:/~bayang/
user-agent:PetalBot
disallow:/~xwindows/
user-agent:Yandex
disallow:/~gareppa/
user-agent:Twitterbot
disallow:/~bayang/
user-agent:bingbot
allow:/~xwindows/$
allow:/~xwindows/index.html$
disallow:/~xwindows/
user-agent:FacebookBot
disallow:/~bayang/
disallow:/~jbd/
user-agent:SemrushBot
disallow:/~xwindows/
user-agent:MJ12bot
disallow:/~xwindows/
user-agent:Amazonbot
disallow:/~bayang/
disallow:/~jbd/
disallow:/~xwindows/
user-agent:Neevabot
disallow:/~xwindows/
user-agent:Googlebot-image
disallow:/~harvettfox96/
user-agent:Wibybot
allow:/~xwindows/
user-agent:DataForSeoBot
disallow:/~bayang/
disallow:/~xwindows/
user-agent:Omgili
disallow:/~jbd/
user-agent:Googlebot
disallow:/~gareppa/
allow:/~xwindows/$
allow:/~xwindows/index.html$
disallow:/~xwindows/
user-agent:MegaIndex.ru
disallow:/~xwindows/
user-agent:Bingbot
disallow:/~gareppa/
user-agent:omgili
disallow:/~bayang/
user-agent:AdsBot-Google
disallow:/~bayang/
user-agent:Bytespider
disallow:/~bayang/
disallow:/~jbd/
disallow:/~xwindows/
user-agent:webprosbot
disallow:/~xwindows/
user-agent:Diffbot
disallow:/~jbd/
user-agent:dotbot
disallow:/~xwindows/
user-agent:cohere-ai
disallow:/~bayang/
user-agent:Google-Extended
disallow:/~bayang/
disallow:/~jbd/
user-agent:Omgilibot
disallow:/~jbd/
disallow:/~jbd/
user-agent:Claude-Web
disallow:/~bayang/
disallow:/~jbd/
user-agent:anthropic-ai
disallow:/~bayang/
disallow:/~jbd/
user-agent:MojeekBot
allow:/~xwindows/
user-agent:BuiltWith
disallow:/~xwindows/
user-agent:YandexBot
allow:/~xwindows/$
allow:/~xwindows/index.html$
disallow:/~xwindows/
user-agent:CCBot
disallow:/~bayang/
disallow:/~xwindows/
user-agent:AhrefsBot
disallow:/~xwindows/
user-agent:omgilibot
disallow:/~bayang/
user-agent:*
disallow:/~alf/
disallow:/~almaren/log/
disallow:/~almaren/md/
disallow:/~andre4ik3/
disallow:/~ant/
allow:/~atamblingpoder/
allow:/~bayang/
disallow:/~bazz/.github/
disallow:/~bazz/.phan/
disallow:/~bazz/assets/
disallow:/~bazz/backup/
disallow:/~bazz/bin/
disallow:/~bazz/cache/
disallow:/~bazz/logs/
disallow:/~bazz/system/
disallow:/~bazz/tests/
disallow:/~bazz/tmp/
disallow:/~bazz/user/
disallow:/~bazz/vendor/
disallow:/~bazz/webserver-configs/
allow:/~bazz/user/pages/
allow:/~bazz/user/themes/
allow:/~bazz/user/images/
allow:/~bazz/
allow:/~bazz*.css$
allow:/~bazz*.js$
allow:/~bazz/system/*.js$
allow:/~cfw/
allow:/~claytron/
disallow:/~cosmiceye/
disallow:/~dbcohn/
disallow:/~dikiaap/
disallow:/~dmi3/
disallow:/~endling/
disallow:/~fenris/
disallow:/~fiveoverfour/
allow:/~fran/
disallow:/~freespeech/
disallow:/~gareppa/
disallow:/~harvettfox96/c/
disallow:/~hj/
allow:/~hnp/# from a pending header
disallow:/~indoneziva/
allow:/~jamiemichelle/
disallow:/~jbgoldberg/
disallow:/~jozi/
allow:/~jpurnell/
allow:/~levin/
allow:/~levin/
disallow:/~meskin/
allow:/~mjk/
disallow:/~mlot/
allow:/~mrkumar/
allow:/~mydeardiary/
allow:/~numbermumbler/
disallow:/~pb/
disallow:/~silver/wp-admin/
allow:/~skk/
disallow:/~somecarbon/
allow:/~speleo/
allow:/~srw/
disallow:/~surfingreg/
allow:/~talhah/
disallow:/~tivrusky/
disallow:/~turbo/test
disallow:/~uslesshumans.txt
allow:/~ve3zsh/
disallow:/~ve3zsh/api
allow:/~xwindows/$
allow:/~xwindows/index.html$
disallow:/~xwindows/
disallow:/~zihtt/

View File

@ -424,8 +424,11 @@
public static function GetDNSRecord($domain, $types = array("MX", "A"), $nameservers = array("8.8.8.8", "8.8.4.4"), $cache = true)
{
// Check for a mail server based on a DNS lookup.
if (!class_exists("Net_DNS2_Resolver")) require_once str_replace("\\", "/", dirname(__FILE__)) . "/Net/DNS2.php";
if (!class_exists('Net_DNS2_Resolver')) {
// Composer autoloader should already be loaded above; this is a last-ditch attempt.
$autoload = dirname(__DIR__, 2) . '/vendor/autoload.php';
if (is_file($autoload)) { require $autoload; }
}
$resolver = new Net_DNS2_Resolver(array("nameservers" => $nameservers));
try
{

View File

@ -1,4 +1,8 @@
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
$title = "sign up for the tilde.club!";
include __DIR__."/../header.php";

View File

@ -1,6 +1,5 @@
<?php
$filepath = __FILE__;
# require __DIR__.'/../vendor/autoload.php';
require_once "email/smtp.php";
function getUserIpAddr() {
@ -43,71 +42,22 @@ function is_ssh_pubkey($string): bool
return false;
}
function forbidden_name($name): bool
function forbidden_name(string $name): bool
{
$badnames = [
'0x0',
'abuse',
'admin',
'administrator',
'auth',
'autoconfig',
'bbj',
'broadcasthost',
'cloud',
'forum',
'ftp',
'git',
'gopher',
'hostmaster',
'imap',
'info',
'irc',
'is',
'isatap',
'it',
'localdomain',
'localhost',
'lounge',
'mail',
'mailer-daemon',
'marketing',
'marketting',
'mis',
'news',
'nobody',
'noc',
'noreply',
'pop',
'pop3',
'postmaster',
'retro',
'root',
'sales',
'security',
'smtp',
'ssladmin',
'ssladministrator',
'sslwebmaster',
'support',
'sysadmin',
'team',
'usenet',
'uucp',
'webmaster',
'wpad',
'www',
'znc',
$bad = [
'0x0','abuse','admin','administrator','auth','autoconfig','bbj','broadcasthost','cloud','forum','ftp',
'git','gopher','hostmaster','imap','info','irc','is','isatap','it','localdomain','localhost','lounge',
'mail','mailer-daemon','marketing','marketting','mis','news','nobody','noc','noreply','pop','pop3',
'postmaster','retro','root','sales','security','smtp','ssladmin','ssladministrator','sslwebmaster',
'support','sysadmin','team','usenet','uucp','webmaster','wpad','www','znc',
];
return in_array(
$name,
array_merge(
$badnames,
file("/var/signups_current", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES),
file("/var/banned_names.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
)
);
$lists = [$bad];
foreach (['/var/signups_current','/var/banned_names.txt'] as $p) {
$t = @file($p, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (is_array($t)) { $lists[] = $t; } // ignore missing/unreadable files
}
return in_array($name, array_merge(...$lists), true);
}
function forbidden_email($email): bool
@ -198,7 +148,9 @@ reason: {$_REQUEST["interest"]}
$makeuser
";
if (mail('root', 'new tilde.club signup', $msgbody)) {
$to = 'root@tilde.club';
$headers = "To: {$to}\r\nFrom: signup <signup@tilde.club>\r\n";
if (mail($to, 'new tilde.club signup', $msgbody, $headers)) {
echo '<div class="alert alert-success" role="alert">
email sent! we\'ll get back to you soon with login instructions! (timeframe for processing signups varies greatly) <a href="/">back to tilde.club home</a>
</div>';