Introduced new const to easily change the sites name globally

This commit is contained in:
Daniel Winzen
2020-01-21 21:47:51 +01:00
parent 29b06199e6
commit e6946ad1ce
15 changed files with 62 additions and 59 deletions

View File

@ -25,9 +25,9 @@ const REQUIRE_APPROVAL=false; //require admin approval of new sites? true/false
const ENABLE_SHELL_ACCESS=true; //allows users to login via ssh, when disabled only (s)ftp is allowed - run setup.php to migrate existing accounts
const ADMIN_PASSWORD='MY_PASSWORD'; //password for admin interface
const SERVICE_INSTANCES=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's']; //one character per instance - run multiple tor+php-fpm instances for load balancing, remove all but one instance if you expect less than 200 accounts. If tor starts using 100% cpu and failing circuits every few hours after a restart, add more instances. In my experience this happens around 250 hidden services per instance - run setup.php after change
const DISABLED_PHP_VERSIONS=[]; //php versions still installed on the system but no longer offered for new accounts
const PHP_VERSIONS=[3 => '7.2', 4 => '7.3', 5 => '7.4']; //currently active php versions
const DEFAULT_PHP_VERSION='7.3'; //default php version
const DISABLED_PHP_VERSIONS=[3 => '7.2']; //php versions still installed on the system but no longer offered for new accounts
const PHP_VERSIONS=[4 => '7.3', 5 => '7.4']; //currently active php versions
const DEFAULT_PHP_VERSION='7.4'; //default php version
const PHP_CONFIG='zend_extension=opcache.so
memory_limit = 256M
error_reporting = E_ALL
@ -134,6 +134,7 @@ const COINPAYMENTS_PUBLIC = 'COINPAYMENTS_PUBLIC'; //Coinpayments public API key
const COINPAYMENTS_MERCHANT_ID = 'COINPAYMENTS_MERCHANT_ID'; //Coinpayments merchant ID
const COINPAYMENTS_IPN_SECRET = 'COINPAYMENTS_IPN_SECRET'; //Coinpayments IPN secret
const COINPAYMENTS_FAKE_BUYER_EMAIL = 'daniel@danwin1210.me'; //fixed email used for the required buyer email field
const SITE_NAME = "Daniel's Hosting";
function get_onion_v2($pkey) : string {
$keyData = openssl_pkey_get_details($pkey);

View File

@ -1,5 +1,5 @@
<?php
include('common.php');
require('common.php');
$db = get_db_instance();
//instances to reload

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$db = get_db_instance();
header('Content-Type: text/html; charset=UTF-8');
session_start(['name'=>'hosting_admin']);
@ -8,7 +8,7 @@ if($_SERVER['REQUEST_METHOD']==='HEAD'){
}
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Admin panel</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Admin panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$db = get_db_instance();
$user=check_login();
$msg='';
@ -19,7 +19,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
header('Content-Type: text/html; charset=UTF-8');
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Delete account</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Delete account</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,10 +1,10 @@
<?php
include('../common.php');
require('../common.php');
header('Content-Type: text/html; charset=UTF-8');
header('X-Accel-Expires: 60');
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - FAQ</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - FAQ</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$db = get_db_instance();
$user=check_login();
if(!empty($_POST['ftp_pass'])){
@ -283,7 +283,7 @@ $dir=htmlspecialchars($dir);
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="<?php echo CANONICAL_URL . $_SERVER['SCRIPT_NAME']; ?>">
<title>Daniel's Hosting - FileManager - Index of <?php echo $dir; ?></title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - FileManager - Index of <?php echo $dir; ?></title>
<style type="text/css">.list td:nth-child(3){word-break:break-all;} .list td:nth-child(5){text-align:right;} .list tr{height:28px;}
.back{min-width:22px; background:no-repeat url(data:img/gif;base64,R0lGODlhFAAWAPH/AAAAADMzM2ZmZpmZmSH5BAUAAAQALAAAAAAUABYAAANLSLrc/oKE8CoZM1O7os7c9WmcN04WdoKQdBIANypAHG5YbS/7kus1RlDxA+p4xqSRpmwCKE7nINqMwKi6wEAY1VaS3tBV/OiRz4sEADs=);}
.dir{min-width:22px; background:no-repeat url(data:img/gif;base64,R0lGODlhFAAWAPH/AAAAADMzM5lmM//MmSH5BAUAAAQALAAAAAAUABYAAANUSLrc/jDKSRm4+E4wuu9AxH1kpimAQHpqiQ5CLMcrHI71GgdXngs8nI8F7A1JReFxZzyygk4iNNpJUmFWmFbF3cJ4hNRsPA6Aw+a0es0LLEzwjDsBADs=);}
@ -388,14 +388,16 @@ function send_not_found(){
}
function send_login(){
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - FileManager - Login</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name=viewport content="width=device-width, initial-scale=1">';
echo '</head><body>';
echo '<p>Please type in your system account password: <form action="files.php" method="post"><input name="ftp_pass" type="password" autofocus><input type="submit" value="Login"></form></p>';
echo '<p><a href="home.php">Go back to dashboard</a>.</p>';
echo '</body></html>';
?>
<!DOCTYPE html><html><head>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - FileManager - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name=viewport content="width=device-width, initial-scale=1">
</head><body>
<p>Please type in your system account password: <form action="files.php" method="post"><input name="ftp_pass" type="password" autofocus><input type="submit" value="Login"></form></p>
<p><a href="home.php">Go back to dashboard</a>.</p>
</body></html>
<?php
}
function ftp_recursive_upload($ftp, $path){
@ -436,7 +438,7 @@ function ftp_recursive_delete($ftp, $file){
function send_rename($dir){
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - FileManager - Rename file</title>';
echo '<title>' . htmlspecialchars(SITE_NAME) . ' - FileManager - Rename file</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name=viewport content="width=device-width, initial-scale=1">';
echo '</head><body>';
@ -455,7 +457,7 @@ function send_rename($dir){
function send_edit($ftp, $dir){
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - FileManager - Edit file</title>';
echo '<title>' . htmlspecialchars(SITE_NAME) . ' - FileManager - Edit file</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name=viewport content="width=device-width, initial-scale=1">';
echo '</head><body>';

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$db = get_db_instance();
$user=check_login();
header('Content-Type: text/html; charset=UTF-8');
@ -14,7 +14,7 @@ if(isset($_POST['action']) && $_POST['action']==='del_db' && !empty($_POST['db']
die($error);
} ?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Delete database</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Delete database</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -40,7 +40,7 @@ if(isset($_POST['action']) && $_POST['action']==='del_onion' && !empty($_POST['o
die($error);
} ?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Delete onion domain</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Delete onion domain</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -123,7 +123,7 @@ if(isset($_POST['action']) && $_POST['action']==='del_domain' && !empty($_POST['
die($error);
} ?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Delete domain</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Delete domain</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -188,7 +188,7 @@ if(isset($_REQUEST['action']) && isset($_POST['domain']) && $_POST['action']==='
}
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Dashboard</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Dashboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -324,8 +324,8 @@ $quota_files_usage = $quota['quota_files_used'] / $quota['quota_files'];
$usage_text = bytes_to_human_readable($quota['quota_size_used'] * 1024) . ' of ' . bytes_to_human_readable($quota['quota_size'] * 1024) . ' - ' . round($quota_usage * 100, 2).'%';
$usage_files_text = "$quota[quota_files_used] of $quota[quota_files] - " . round($quota_files_usage * 100, 2).'%';
?>
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <?php echo ENABLE_UPGRADE ? '<a href="upgrade.php?upgrade=1g_quota">Upgrade</a>' : ''; ?></p>
<p>Your file number usage: <meter value="<?php echo round($quota_files_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <?php echo ENABLE_UPGRADE ? '<a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a>' : ''; ?></p>
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <?php echo ENABLE_UPGRADES ? '<a href="upgrade.php?upgrade=1g_quota">Upgrade</a>' : ''; ?></p>
<p>Your file number usage: <meter value="<?php echo round($quota_files_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <?php echo ENABLE_UPGRADES ? '<a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a>' : ''; ?></p>
<h3>Logs</h3>
<table border="1">
<tr><th>Date</th><th>access.log</th><th>error.log</th></tr>

View File

@ -1,10 +1,10 @@
<?php
include('../common.php');
require('../common.php');
header('Content-Type: text/html; charset=UTF-8');
header('X-Accel-Expires: 60');
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,11 +1,11 @@
<?php
include_once('../common.php');
require_once('../common.php');
header('Content-Type: text/html; charset=UTF-8');
header('X-Accel-Expires: 60');
$db = get_db_instance();
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - List of hosted sites</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - List of hosted sites</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$user=check_login();
if(!isset($_REQUEST['old']) || $_REQUEST['old']==0){
$old='';

View File

@ -1,6 +1,5 @@
<?php
include('../common.php');
$db = get_db_instance();
require('../common.php');
header('Content-Type: text/html; charset=UTF-8');
session_start();
if(!empty($_SESSION['hosting_username']) && empty($_SESSION['2fa_code'])){
@ -10,6 +9,7 @@ if(!empty($_SESSION['hosting_username']) && empty($_SESSION['2fa_code'])){
$msg='';
$username='';
if($_SERVER['REQUEST_METHOD']==='POST'){
$db = get_db_instance();
$ok=true;
if($error=check_captcha_error()){
$msg.="<p style=\"color:red;\">$error</p>";
@ -55,25 +55,25 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
exit;
}
}
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - Login</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '<link rel="canonical" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '">';
echo '</head><body>';
echo '<h1>Hosting - Login</h1>';
echo '<p><a href="index.php">Info</a> | <a href="register.php">Register</a> | Login | <a href="list.php">List of hosted sites</a> | <a href="faq.php">FAQ</a></p>';
echo $msg;
echo '<form method="POST" action="login.php"><table>';
echo '<tr><td>Username</td><td><input type="text" name="username" value="';
?>
<!DOCTYPE html><html><head>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="<?php echo CANONICAL_URL . $_SERVER['SCRIPT_NAME']; ?>">
</head><body>
<h1>Hosting - Login</h1>
<p><a href="index.php">Info</a> | <a href="register.php">Register</a> | Login | <a href="list.php">List of hosted sites</a> | <a href="faq.php">FAQ</a></p>
<?php echo $msg; ?>
<form method="POST" action="login.php"><table>
<tr><td>Username</td><td><input type="text" name="username" value="<?php
if(isset($_POST['username'])){
echo htmlspecialchars($_POST['username']);
}
echo '" required autofocus></td></tr>';
echo '<tr><td>Password</td><td><input type="password" name="pass" required></td></tr>';
send_captcha();
?>
?>" required autofocus></td></tr>
<tr><td>Password</td><td><input type="password" name="pass" required></td></tr>
<?php send_captcha(); ?>
<tr><td colspan="2"><input type="submit" value="Login"></td></tr>
</table></form>
<p>If you disabled cookies, please re-enable them. You can't log in without!</p>

View File

@ -1,5 +1,5 @@
<?php
include('../common.php');
require('../common.php');
$db = get_db_instance();
$user=check_login();
if(!isset($_REQUEST['type'])){
@ -37,7 +37,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
}
header('Content-Type: text/html; charset=UTF-8');
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - Change password</title>';
echo '<title>' . htmlspecialchars(SITE_NAME) . ' - Change password</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';

View File

@ -1,6 +1,5 @@
<?php
include('../common.php');
$db = get_db_instance();
require('../common.php');
header('Content-Type: text/html; charset=UTF-8');
session_start();
if(!empty($_SESSION['hosting_username'])){
@ -9,7 +8,7 @@ if(!empty($_SESSION['hosting_username'])){
}
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Register</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Register</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -20,6 +19,7 @@ if(!empty($_SESSION['hosting_username'])){
<p><a href="index.php">Info</a> | Register | <a href="login.php">Login</a> | <a href="list.php">List of hosted sites</a> | <a href="faq.php">FAQ</a></p>
<?php
if($_SERVER['REQUEST_METHOD']==='POST'){
$db = get_db_instance();
$ok=true;
$onion='';
$onion_version=3;

View File

@ -10,7 +10,7 @@ use chillerlan\QRCode\QROptions;
header('Content-Type: text/html; charset=UTF-8');
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Upgrade account</title>
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Upgrade account</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,5 +1,5 @@
<?php
include('common.php');
require('common.php');
if(!extension_loaded('pdo_mysql')){
die("Error: You need to install and enable the PDO php module\n");
}