Added PHP 7.2 support + minor bugfixes and performance tweaks

Note when applying this update you will have to update existing nginx vhosts to match new listening addresses (IPv6). Preferably you should update them to unix socket though and apply the changes to the tor hidden service config as well
This commit is contained in:
Daniel Winzen
2018-02-10 22:10:07 +01:00
parent c65055a9bb
commit fa24bb61ec
95 changed files with 3075 additions and 59 deletions

View File

@ -24,7 +24,8 @@ header('Content-Type: text/html; charset=UTF-8');
<!DOCTYPE html><html><head>
<title>Daniel's Hosting - Delete account</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head><body>
<p>This will delete your account and all data asociated with it. It can't be un-done. Are you sure?</p>
<?php echo $msg; ?>

View File

@ -65,6 +65,7 @@ const TYPES=[
'xml'=>'doc',
'doc'=>'doc',
'docx'=>'doc',
'css'=>'doc',
'html'=>'doc',
'htm'=>'doc',
'shtml'=>'doc',
@ -131,7 +132,7 @@ if(!empty($_POST['mkfile']) && !empty($_POST['name'])){
$tmpfile='/tmp/'.uniqid();
touch($tmpfile);
ftp_put($ftp, $_POST['name'], $tmpfile, FTP_BINARY);
unlink($tmpflie);
unlink($tmpfile);
}
if(!empty($_POST['delete']) && !empty($_POST['files'])){

View File

@ -54,4 +54,3 @@ echo '<tr><td>Today</td><td><a href="log.php?type=access&amp;old=0" target="_bla
echo '<tr><td>Yesterday</td><td><a href="log.php?type=access&amp;old=1" target="_blank">access.log</log></td><td><a href="log.php?type=error&amp;old=1" target="_blank">error.log</a></td></tr>';
echo '</table>';
echo '</body></html>';
?>

View File

@ -1,18 +1,28 @@
<?php
include('../common.php');
header('Content-Type: text/html; charset=UTF-8');
if(isset($_SERVER['HTTP_HOST']) && preg_match('/danwin1210\.(i2p|me)$/', $_SERVER['HTTP_HOST'])){
if(preg_match('/\.me$/', $_SERVER['HTTP_HOST'])){
$host='https://danwin1210.me';
}else{
$host='http://danwin1210.i2p';
}
}else{
$host='http://tt3j2x4k5ycaa5zt.onion';
}
?>
<!DOCTYPE html><html><head>
<title>Daniel's Hosting</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="author" content="Daniel Winzen">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head><body>
<p>Info | <a href="register.php">Register</a> | <a href="login.php">Login</a> | <a href="list.php">List of hosted sites</a> | <a href="faq.php">FAQ</a></p>
<p>Here you can get yourself a hosting account on my server.</p>
<p>What you will get:</p>
<ul>
<li>Free anonymous webhosting</li>
<li>Chose between PHP 7.0, 7.1 or no PHP support</li>
<li>Chose between PHP 7.0, 7.1, 7.2 or no PHP support</li>
<li>Nginx Webserver</li>
<li>SQLite support</li>
<li>1 MariaDB (MySQL) database</li>
@ -26,7 +36,7 @@ header('Content-Type: text/html; charset=UTF-8');
<li>Mail sent to anything@your.onion gets automatically redirected to your inbox</li>
<li>Your own .onion address</li>
<li>On request your own clearnet domain or a free subdomain of danwin1210.me. I can setup an I2P domain as well.</li>
<li>There is a missing feature or you need a special configuration? Just <a href="http://tt3j2x4k5ycaa5zt.onion/contact.php">contact me</a> and I'll see what I can do.</li>
<li>There is a missing feature or you need a special configuration? Just <a href="<?php echo "$host/contact.php"; ?>">contact me</a> and I'll see what I can do.</li>
<li>Empty/Unused accounts will be automatically deleted after a month</li>
<li>More to come…</li>
</ul>

View File

@ -25,4 +25,3 @@ while($tmp=$stmt->fetch(PDO::FETCH_NUM)){
}
echo '</table>';
echo '</body></html>';
?>

View File

@ -73,7 +73,8 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
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=viewport content="width=device-width, initial-scale=1">';
echo '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '</head><body>';
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;
@ -91,4 +92,3 @@ echo '<tr><td colspan="2"><input type="submit" value="Login"></td></tr>';
echo '</table></form>';
echo '<p>If you disabled cookies, please re-enable them. You currently can\'t log in without</p>';
echo '</body></html>';
?>

View File

@ -2,4 +2,3 @@
session_start();
session_destroy();
header('Location: login.php');
?>

View File

@ -28,7 +28,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
$stmt->execute([$user['onion'], $hash]);
$msg.='<p style="color:green;">Successfully changed system account password, change will take affect within the next minute.</p>';
}elseif($_REQUEST['type']==='sql'){
$stmt=$db->prepare("SET PASSWORD FOR '$user[onion].onion'@'localhost'=PASSWORD(?);");
$stmt=$db->prepare("SET PASSWORD FOR '$user[onion].onion'@'%'=PASSWORD(?);");
$stmt->execute([$_POST['newpass']]);
$db->exec('FLUSH PRIVILEGES;');
$msg.='<p style="color:green;">Successfully changed sql password.</p>';
@ -41,7 +41,8 @@ header('Content-Type: text/html; charset=UTF-8');
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - Change password</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 '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '</head><body>';
echo $msg;
echo '<form method="POST" action="password.php"><table>';
@ -69,4 +70,3 @@ echo '<tr><td colspan="2"><input type="submit" value="Reset"></td></tr>';
echo '</table></form>';
echo '<p><a href="home.php">Go back to dashboard.</a></p>';
echo '</body></html>';
?>

View File

@ -14,7 +14,8 @@ if(!empty($_SESSION['hosting_username'])){
echo '<!DOCTYPE html><html><head>';
echo '<title>Daniel\'s Hosting - Register</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 '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '</head><body>';
echo '<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>';
if($_SERVER['REQUEST_METHOD']==='POST'){
@ -107,7 +108,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
if(isset($_POST['public']) && $_POST['public']==1){
$public=1;
}
if(isset($_POST['php']) && in_array($_POST['php'], [1, 2])){
if(isset($_POST['php']) && in_array($_POST['php'], [1, 2, 3])){
$php=$_POST['php'];
}
if(isset($_POST['autoindex']) && $_POST['autoindex']==1){
@ -156,7 +157,7 @@ if($_SERVER['REQUEST_METHOD']!=='POST' || (isset($_POST['public']) && $_POST['pu
}else{
$public='';
}
if(isset($_POST['autoindex']) && $_POST['public']==1){
if(isset($_POST['autoindex']) && $_POST['autoindex']==1){
$autoindex=' checked';
}else{
$autoindex='';
@ -164,14 +165,17 @@ if(isset($_POST['autoindex']) && $_POST['public']==1){
$nophp='';
$php70='';
$php71='';
$php72='';
if(isset($_POST['php']) && $_POST['php']==0){
$nophp=' selected';
}elseif(isset($_POST['php']) && $_POST['php']==1){
$php70=' selected';
}elseif(isset($_POST['php']) && $_POST['php']==2){
$php71=' selected';
}else{
$php70=' selected';
$php72=' selected';
}
echo '<tr><td>PHP version</td><td><select name="php"><option value="0"'.$nophp.'>None</option><option value="1" '.$php70.'>PHP 7.0</option><option value="2"'.$php71.'>PHP 7.1</option></select></td></tr>';
echo '<tr><td>PHP version</td><td><select name="php"><option value="0"'.$nophp.'>None</option><option value="1" '.$php70.'>PHP 7.0</option><option value="2"'.$php71.'>PHP 7.1</option><option value="3"'.$php72.'>PHP 7.2</option></select></td></tr>';
echo '<tr><td colspan=2><label><input type="checkbox" name="public" value="1"'.$public.'>Publish site on list of hosted sites</label></td></tr>';
echo '<tr><td colspan=2><label><input type="checkbox" name="autoindex" value="1"'.$autoindex.'>Enable autoindex (listing of files)</label></td></tr>';
echo '<tr><td>Custom private key<br>(optional)</td><td><textarea name="private_key" rows="5" cols="28">';