From bee350cb4b76c74b40fdcc3b68f72f92e6653925 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sat, 13 May 2017 18:11:02 +0200 Subject: [PATCH] Make notification email configurable --- var/www/common.php | 1 + var/www/html/register.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/var/www/common.php b/var/www/common.php index 1a72db3..7f7b370 100644 --- a/var/www/common.php +++ b/var/www/common.php @@ -11,6 +11,7 @@ const SERVERS=[ //servers and ports we are running on 'dhosting4okcs22v.onion'=>['sftp'=>22, 'ftp'=>21, 'pop3'=>'110', 'imap'=>'143', 'smtp'=>'25'], 'danwin1210.me'=>['sftp'=>22, 'ftp'=>21, 'pop3'=>'', 'imap'=>'', 'smtp'=>''] ]; +const EMAIL_TO=''; //Send email notifications about new registrations to this address function get_onion($pkey){ $keyData = openssl_pkey_get_details($pkey); diff --git a/var/www/html/register.php b/var/www/html/register.php index 598d057..196fb47 100644 --- a/var/www/html/register.php +++ b/var/www/html/register.php @@ -131,10 +131,12 @@ if($_SERVER['REQUEST_METHOD']==='POST'){ $db->exec('FLUSH PRIVILEGES;'); $stmt=$db->prepare('INSERT INTO new_account (onion, password) VALUES (?, ?);'); $stmt->execute([$onion, get_system_hash($_POST['pass'])]); - $title="A new hidden service $onion has been created"; - $msg="A new hidden service http://$onion.onion has been created"; - $headers="From: www-data \r\nContent-Type: text/plain; charset=UTF-8\r\n"; - mail('daniel@tt3j2x4k5ycaa5zt.onion', $title, $msg, $headers); + if(EMAIL_TO!==''){ + $title="A new hidden service $onion has been created"; + $msg="A new hidden service http://$onion.onion has been created"; + $headers="From: www-data \r\nContent-Type: text/plain; charset=UTF-8\r\n"; + mail(EMAIL_TO, $title, $msg, $headers); + } echo "

Your onion domain $onion.onion has successfully been created. Please wait up to one minute until the changes have been processed. You can then login here.

"; } }