Make notification email configurable

This commit is contained in:
Daniel Winzen
2017-05-13 18:11:02 +02:00
parent c7d104a0da
commit bee350cb4b
2 changed files with 7 additions and 4 deletions

View File

@ -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);

View File

@ -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'])]);
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 <www-data>\r\nContent-Type: text/plain; charset=UTF-8\r\n";
mail('daniel@tt3j2x4k5ycaa5zt.onion', $title, $msg, $headers);
mail(EMAIL_TO, $title, $msg, $headers);
}
echo "<p style=\"color:green;\">Your onion domain <a href=\"http://$onion.onion\" target=\"_blank\">$onion.onion</a> has successfully been created. Please wait up to one minute until the changes have been processed. You can then login <a href=\"login.php\">here</a>.</p>";
}
}