diff --git a/README.md b/README.md index dc9f6d6..5953cfb 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ Once installed create a mysql user for phpmyadmin and cofigure it in `/var/www/h ``` mysql CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'MY_PASSWORD'; +CREATE DATABASE phpmyadmin; GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'%'; FLUSH PRIVILEGES; quit diff --git a/var/www/common.php b/var/www/common.php index f28c3ee..dd51bf3 100644 --- a/var/www/common.php +++ b/var/www/common.php @@ -600,9 +600,14 @@ function del_user_db(PDO $db, int $user_id, string $mysql_db) { } } +function get_new_tor_instance(PDO $db){ + $stmt = $db->query('SELECT s.ID FROM service_instances AS s LEFT JOIN onions AS o ON (s.ID = o.instance) GROUP BY s.ID ORDER BY count(s.ID) LIMIT 1;'); + return $stmt->fetch(PDO::FETCH_NUM)[0]; +} + function add_user_onion(PDO $db, int $user_id, string $onion, string $priv_key, int $onion_version) { $stmt=$db->prepare('INSERT INTO onions (user_id, onion, private_key, version, enabled, instance) VALUES (?, ?, ?, ?, 2, ?);'); - $stmt->execute([$user_id, $onion, $priv_key, $onion_version, SERVICE_INSTANCES[array_rand(SERVICE_INSTANCES)]]); + $stmt->execute([$user_id, $onion, $priv_key, $onion_version, get_new_tor_instance($db)]); } function del_user_onion(PDO $db, int $user_id, string $onion) { diff --git a/var/www/html/admin.php b/var/www/html/admin.php index a00280c..890a92e 100644 --- a/var/www/html/admin.php +++ b/var/www/html/admin.php @@ -55,10 +55,10 @@ if(empty($_SESSION['logged_in'])){ echo '
"; echo ''; echo ''; - $stmt=$db->query('SELECT users.username, onions.onion FROM users INNER JOIN onions ON (onions.user_id=users.id) ORDER BY users.username;'); + $stmt=$db->query('SELECT users.username, onions.onion, onions.enabled FROM users INNER JOIN onions ON (onions.user_id=users.id) ORDER BY users.username;'); $sccounts = []; while($tmp=$stmt->fetch(PDO::FETCH_NUM)){ - $accounts[$tmp[0]] []= $tmp[1]; + $accounts[$tmp[0]] []= [$tmp[1], $tmp[2]]; } foreach($accounts as $account => $onions){ echo ""; + echo ""; } echo '
UsernameOnion linkAction
$account"; @@ -69,9 +69,13 @@ if(empty($_SESSION['logged_in'])){ }else{ echo '
'; } - echo "$onion.onion"; + if($onion[1]=='1'){ + echo "$onion[0].onion"; + }else{ + echo "$onion[0].onion"; + } } - echo "
'; }elseif(substr($_REQUEST['action'], 0, 7) === 'approve'){ diff --git a/var/www/html/index.php b/var/www/html/index.php index e14b554..a652ee9 100644 --- a/var/www/html/index.php +++ b/var/www/html/index.php @@ -45,6 +45,6 @@ header('Content-Type: text/html; charset=UTF-8');
  • No proxy scripts! (You are already using TOR and this will just burden the network)
  • No IP logger or similar de-anonymizer sites!
  • I preserve the right to delete any site for violating these rules and adding new rules at any time.
  • -
  • Should you not honor these rules, I will (have to) work together with Law Enfocements!
  • +
  • Should you not honor these rules, I will (have to) work together with Law Enforcement!
  • diff --git a/var/www/html/register.php b/var/www/html/register.php index 1ba12bb..e3713be 100644 --- a/var/www/html/register.php +++ b/var/www/html/register.php @@ -108,7 +108,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){ }elseif($ok){ $mysql_user = add_mysql_user($db, $_POST['pass']); $stmt=$db->prepare('INSERT INTO users (username, system_account, password, dateadded, public, php, autoindex, mysql_user, instance) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);'); - $stmt->execute([$_POST['username'], substr("$onion.onion", 0, 32), $hash, time(), $public_list, $php, $autoindex, $mysql_user, SERVICE_INSTANCES[array_rand(SERVICE_INSTANCES)]]); + $stmt->execute([$_POST['username'], substr("$onion.onion", 0, 32), $hash, time(), $public_list, $php, $autoindex, $mysql_user, get_new_tor_instance($db)]); $user_id = $db->lastInsertId(); $stmt = $db->prepare('INSERT INTO disk_quota (user_id, quota_size, quota_files) VALUES (?, ?, ?);'); $stmt->execute([$user_id, DEFAULT_QUOTA_SIZE, DEFAULT_QUOTA_FILES]);