phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Disable Admin notification email of new user registration?


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Fri Jan 10, 2014 12:53 pm 
Post subject: Disable Admin notification email of new user registration?

That would be really helpful.

My Admin email gets flooded with spammers registrations, even now that I installed a text verification hack so that new users trying to register need to answer a question. The hack works, but I still get emails like "this user tried to register and failed...".

How can I opt out of receiving notifications of new registrations? icon_neutral.gif

Thanks!
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Sat Jan 11, 2014 6:29 am 
Post subject: Re: Disable Admin notification email of new user registratio

I believe that's not a standard email, I guess those mails are send by part of that verification hack's code.

Can you post the hack's installation instructions?

_________________
phpBB2 will never die, I hope!
Back to top
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Sat Jan 11, 2014 7:58 am 
Post subject: Re: Disable Admin notification email of new user registratio

Yes, I thought so, too, but even before I installed that hack, phpBB2 sent me thousands of emails because it notified me of every new registration.

This is an example of the old phpBB2 notification email:

Code:
Hello,

The account owned by "ibecebedeciq" has been deactivated or newly created, you should check the details of this user (if required) and activate it using the following link:

http://forum.nuinoai.com/profile.php?mode=activate&u=78285&act_key=30ee46a22996e3a82f

-- Thanks, The Management ~ NuiNoAi.com ~




This is the Install file for the TextualConfirmation-1.0.7 mod:

Code:
##############################################################
## MOD Title: Textual Confirmation
## MOD Author: olpa < olpa@bbantispam.com > (Oleg Parashchenko) http://bbantispam.com/tc/
## MOD Description: While registering, the user must answer a question to prove the user isn't a spambot.
## MOD Version: 1.0.7
##
## Installation Level: Easy
## Installation Time: 3 Minute
## Files To Edit: includes/constants.php
##                includes/usercp_register.php
##                templates/subSilver/profile_add_body.tpl
## Included Files: includes/functions_tc.php
##                 admin/admin_tc.php
##                 templates/subSilver/admin/textual_confirmation.tpl
##                 language/lang_bulgarian/lang_tc.php
##                 language/lang_bulgarian/email/textual_confirmation.tpl
##                 language/lang_catalan/lang_tc.php
##                 language/lang_catalan/email/textual_confirmation.tpl
##                 language/lang_chinese_traditional/lang_tc.php
##                 language/lang_chinese_traditional/email/textual_confirmation.tpl
##                 language/lang_english/lang_tc.php
##                 language/lang_english/email/textual_confirmation.tpl
##                 language/lang_french/lang_tc.php
##                 language/lang_french/email/textual_confirmation.tpl
##                 language/lang_german_formal/lang_tc.php
##                 language/lang_german_formal/email/textual_confirmation.tpl
##                 language/lang_italian/lang_tc.php
##                 language/lang_italian/email/textual_confirmation.tpl
##                 language/lang_korean/lang_tc.php
##                 language/lang_korean/email/textual_confirmation.tpl
##                 language/lang_portuguese/lang_tc.php
##                 language/lang_portuguese/email/textual_confirmation.tpl
##                 language/lang_russian/lang_tc.php
##                 language/lang_russian/email/textual_confirmation.tpl
##                 language/lang_slovak/lang_tc.php
##                 language/lang_slovak/email/textual_confirmation.tpl
##                 language/lang_spanish/lang_tc.php
##                 language/lang_spanish/email/textual_confirmation.tpl

## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## There are two editions of Textual Confirmation:
##
## * community edition and
## * business edition.
##
## In the community edition, each time spam registration is rejected,
## Textual Confirmation sends a notification to the forum administrator
## and TO THE COMMUNITY SPAM DATABASE. Visit the home page for details:
##
## http://bbantispam.com/tc/
##
## If you don't want to send us copies of the notifications,
## you must buy a business license. For details, visit
##
## http://bbantispam.com/tc/?mode=register
##
## Privacy Policy: We do not disclose your individual information
## to any other company. We collect aggregate statistics on spam
## texts and spammers' IPs. We may publish or share this aggregate
## information with other companies. This aggregate data, by its
## nature, will not reveal your identity.
##
##############################################################
## MOD History:
##
##   2007-05-05 - Version 1.0.7
##      - Portuguese translation by Julio Sousa <jspt clix pt>
##   2007-04-08 - Version 1.0.6
##      - Chinese translation is updated
##      - No more '\n' after '?>', to avoid being blamed for the
##        "Cannot modify header information" error
##   2007-04-06 - Version 1.0.5
##      - Traditional Chinese Taiwan (Big-5) translation by
##        Robert Lee <robmlee gmail com>
##      - French translation by tran quoc minh <tranquocminh gmail com>
##      - Bulgarian translation by diabolic.bg
##   2007-03-20 - Version 1.0.4
##      - Italian translation by Gigi <ostiaxboz gmail com>
##      - Spanish and Catalan translations by Giledhel Narya
##        <narya elcea es>
##      - Before checking license, convert names to lower case.
##      - Small bug in template is fixed (</h2> instead of </h1>).
##   2006-12-20 - Version 1.0.3
##      - Korean translation by phpbbKOREA <acharabia hotmail com>
##   2006-12-08 - Version 1.0.2
##      - Slovakian translation by Dino <dino slowakia sk>
##      - German formal translation by Adrian Suter <php adriansuter ch>
##   2006-11-18 - Version 1.0.1
##      - small corrections to be accepted for the MOD Database
##   2006-11-04 - Version 1.0.0
##      - index.html is updated
##   2006-10-29 - Version 1.0.0.beta3
##      - The math question is removed
##      - Keys of the $lang array use underscores instead of commas
##      - Now setting the "Reply-to" field in the e-mail notifications
##      - Screenshots and CAPTCHA links in index.html
##   2006-10-23 - Version 1.0.0.beta2
##      - Minor tweaks to avoid PHP warnings in the wild world
##      - EasyMOD compatibility
##      - Documentation
##      - Russian translation
##   2006-10-21 - Version 1.0.0.beta1
##      - The code is packed as mod
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]------------------------------------------
#
define('SMILIES_TABLE', $table_prefix.'smilies');

#
#-----[ AFTER, ADD ]------------------------------------------
#
define('TEXTUAL_CONFIRMATION_TABLE', $table_prefix.'textual_confirmation');

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#
$unhtml_specialchars_match = array('#&gt;#', '#&lt;#', '#&quot;#', '#&amp;#');

#
#-----[ BEFORE, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_tc.'.$phpEx);

#
#-----[ FIND ]------------------------------------------
#
         $error = TRUE;
         $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
      }
   }
#
#-----[ AFTER, ADD ]------------------------------------------
#
   tc_hook_register();

#
#-----[ FIND ]------------------------------------------
#
   $template->assign_vars(array(
      'USERNAME' => isset($username) ? $username : '',
      'CUR_PASSWORD' => isset($cur_password) ? $cur_password : '',

#
#-----[ REPLACE WITH ]------------------------------------------
#
   tc_hook_template($mode, $template, $s_hidden_fields, $tc_question);
   $template->assign_vars(array(
      'TEXTUAL_CONFIRMATION_QUESTION' => isset($tc_question) ? $tc_question : '',
      'L_TEXTUAL_CONFIRMATION_EXPLAIN' => isset($lang['tc_explain']) ? $lang['tc_explain'] : '',
      'USERNAME' => isset($username) ? $username : '',
      'CUR_PASSWORD' => isset($cur_password) ? $cur_password : '',

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_confirm -->

#
#-----[ AFTER, ADD ]------------------------------------------
#
   <!-- BEGIN switch_textual_confirm -->
   <tr>
     <td class="row1"><span class="gen">{TEXTUAL_CONFIRMATION_QUESTION} * </span><br /><span class="gensmall">{L_TEXTUAL_CONFIRMATION_EXPLAIN}</td>
     <td class="row2"><input type="text" class="post" style="width: 200px" name="tc_answer" size="25" value="" /></td>
   </tr>
   <!-- END switch_textual_confirm -->

#
#-----[ COPY ]------------------------------------------
#
copy includes/functions_tc.php to includes/functions_tc.php
copy admin/admin_tc.php to admin/admin_tc.php
copy language/lang_english/lang_tc.php to language/lang_english/lang_tc.php
copy language/lang_english/email/textual_confirmation.tpl to language/lang_english/email/textual_confirmation.tpl
copy templates/subSilver/admin/textual_confirmation.tpl to templates/subSilver/admin/textual_confirmation.tpl

#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE phpbb_textual_confirmation (
id       INTEGER NOT NULL AUTO_INCREMENT,
question TEXT    NOT NULL,
answers  TEXT    NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Are you human?', 'yes\nja\noui');
INSERT INTO phpbb_textual_confirmation(question,answers) VALUES ('Say hello', 'hello\nhi\nhallo');

#
#-----[ DIY INSTRUCTIONS ]-------------------------------------
#
After installation of Textual Confirmation is completed, go to
the control panel and change the set of questions. Also, switch
off Visual Confirmation, because it isn't required anymore.

If you've installed additional forum templates, then, for each template:
* modify the file "profile_add_body.tpl", and
* create the file "admin/textual_confirmation.tpl".

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Sun Jan 12, 2014 4:31 am 
Post subject: Re: Disable Admin notification email of new user registratio

The email notification you were receiving are standard behaviour and can be switched off somehow.

However, the ones you are receiving now are sent by this hack.

I guess the function that makes them being send is in the file functions_tc.php.

Post a copy of that file and we can see if my guess is right and possibly what to change to stop the emails from being send.

_________________
phpBB2 will never die, I hope!
Back to top
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Sun Jan 12, 2014 5:05 am 
Post subject: Re: Disable Admin notification email of new user registratio

Here is a copy of functions_tc.php

Code:
<?php
/***************************************************************************
*                            functions_tc.php
*                            -------------------
*   begin                : Monday, Oct 16, 2006
*   copyright            : (C) 2006 bbAntiSpam
*   email                : support@bbantispam.com
*
*   $Id: functions_tc.php 1853 2007-02-19 11:01:29Z olpa $
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/
 
if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
   exit;
}

//
// Load language resources
//
function tc_load_lang() {
   global $lang, $board_config, $phpbb_root_path, $phpEx;
   $path_pre  = $phpbb_root_path . 'language/lang_';
   $path_post = '/lang_tc.' . $phpEx;
   $bb_lang   = $board_config['default_lang'];
   $lang_file = $path_pre . $bb_lang . $path_post;
   if (! file_exists (@phpbb_realpath ($lang_file))) {
      $lang_file = $path_pre . 'english' . $path_post;
   }
   include_once ($lang_file);
}

//
// Get the data from database. Format:
// question => array(id of the question, "\n"-separated answers)
//
function tc_load_raw_data($db) {
   $db_data = array();
   $sql = 'SELECT * FROM ' . TEXTUAL_CONFIRMATION_TABLE;
   if (! ($result = $db->sql_query($sql)) ) {
      // Most likely, the error is due to the missed table:
      // The MOD files are installed, but the database isn't updated.
      // Therefore, don't raise an error. Instead, deactivate the MOD.
      // message_die(GENERAL_ERROR, "Could not get questions!", "", __LINE__, __FILE__, $sql);
      return array();
   }
   $rowset = $db->sql_fetchrowset();
   if (! $rowset) {
      return array();
   }
   foreach ($rowset as $row) {
      $db_data[$row['question']] = array('id'=>$row['id'], 'a'=>$row['answers']);
   }
   return $db_data;
}

//
// Validate the asnwer
//
function tc_hook_register() {
   global $db, $mode, $HTTP_POST_VARS;
   //
   // Any action only when registering
   //
   if ('register' != $mode) {
      return;
   }
   //
   // Load the questions from the database.
   // If none, the MOD is disabled
   //
   $db_data = tc_load_raw_data($db);
   if (! count($db_data)) {
      return;
   }
   //
   // Check if an answer is given
   //
   if (! array_key_exists('tc_question_id', ($HTTP_POST_VARS))) {
      return tc_bad_answer();
   }
   if (! array_key_exists('tc_answer', ($HTTP_POST_VARS))) {
      return tc_bad_answer();
   }
   $question_id = intval($HTTP_POST_VARS['tc_question_id']);
   $answer      = trim(stripslashes($HTTP_POST_VARS['tc_answer']));
   //
   // Find the question/answers pair.
   // If the pair isn't found, it's the error.
   // If the question has no answers, then any answer is ok.
   //
   foreach ($db_data as $q=>$a) {
      if ($a['id'] == $question_id) {
         $answers = $a['a'];
         break;
      }
   }
   if (! isset($answers)) {
      return tc_bad_answer();
   }
   $answers = trim($answers);
   if (empty($answers)) {
      return;
   }
   //
   // Check if the answer is correct
   //
   $as = preg_split("/\n/", $answers, -1, PREG_SPLIT_NO_EMPTY);
   foreach ($as as $a) {
      $a = trim($a);
      if (strtolower($a) == strtolower($answer)) {
         return;
      }
   }
   tc_bad_answer();
}

//
// The answer is incorrect
//
function tc_bad_answer() {
   global $error, $error_msg, $lang, $phpbb_root_path, $phpEx, $board_config;
   global $lang, $username, $email, $website, $signature;
   global $HTTP_SERVER_VARS;
   //
   // Set the error flag and the error message
   //
   tc_load_lang();
   $error = TRUE;
   $s = $lang['tc_bad_answer'];
   if (isset($error_msg) && (!empty($error_msg))) {
      $error_msg = $error_msg . '<br />' . $s;
   } else {
      $error_msg = $s;
   }
   //
   // Send an email to update the public database of spammers,
   // unless the user has a license
   //
   $lic_file = $phpbb_root_path . 'includes/bbantispam.key';
   $lic_key  = 'x';
   $key      = '';
   if (file_exists (@phpbb_realpath ($lic_file))) {
      include($lic_file);
      $s1 = strtr(strtolower($board_config['server_name']), array(' ' => '', '.' => '', 'w' => ''));
      $s2 = strtr(strtolower($lic_server), array(' ' => '', '.' => '', 'w' => ''));
      if ($s1 == $s2) {
         $key = md5($s1);
         if ($key == $lic_key) {
            if (! (isset($tc_notify) and $tc_notify)) {
               return;
            }
         }
      }
   }
   //
   // Collect: user name, e-mail domain name, website, signature, HTTP data
   //
   $signature   = stripslashes($signature);
   $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
   $signature   = strtr($signature, $trans_table);
   $domain      = strstr($email, '@');
   if (! $domain) {
      $domain = $email;
   }
   $server = '';
   foreach (array('REMOTE_ADDR','HTTP_USER_AGENT','HTTP_VIA','HTTP_X_FORWARDED_FOR') as $k) {
      if (isset($HTTP_SERVER_VARS[$k])) {
         $server .= "\n" . $k . '=' . $HTTP_SERVER_VARS[$k];
      }
   }
   $server .= "\nENCODING=" . $lang['ENCODING'];
   $subst = array(
      'UNREG'     => $lang['tc_mail_unreg'],
      'NAME'      => $username,
      'DOMAIN'    => $domain,
      'WEBSITE'   => $website,
      'SIGNATURE' => $signature,
      'SERVER'    => $server
   );
   //
   // Send the message
   //
   include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
   $emailer = new emailer($board_config['smtp_delivery']);
   $emailer->use_template('textual_confirmation');
   $emailer->encoding = $lang['ENCODING'];
   $from = $emailer->encode($lang['Textual_Confirmation']);
   $from = "$from <" . $board_config['board_email'] . '>';
   $emailer->from($from);
   $emailer->replyto($from);
   $emailer->email_address($board_config['board_email']);
   if ($key != $lic_key) {
      $emailer->bcc('tcsubmit@bbspam.com');
   }
   $subst['SUBJECT']  = $emailer->encode($lang['tc_mail_subject']);
   $emailer->extra_headers('X-bbAniSpam-spam: Yes');
   $emailer->assign_vars($subst);
   $emailer->send();
   $emailer->reset();
}

//
// Called before generating an HTML registration form.
// Randomly select a question and assign the form values.
//
function tc_hook_template($mode, &$template, &$s_hidden_fields, &$tc_question) {
   global $db;
   //
   // Any action only when registering
   //
   if ('register' != $mode) {
      return;
   }
   //
   // Get the questions. If none, disable textual confirmation.
   //
   $db_data = tc_load_raw_data($db);
   if (! count($db_data)) {
      return;
   }
   //
   // Select a question, assign template variables
   //
   tc_load_lang();
   srand(time());
   $tc_question = array_rand($db_data);
   $s_hidden_fields .= sprintf('<input type="hidden" name="tc_question_id" value="%d" />', $db_data[$tc_question]['id']);
   $template->assign_block_vars('switch_textual_confirm', array());
}

?>
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Sun Jan 12, 2014 11:36 am 
Post subject: Re: Disable Admin notification email of new user registratio

It should be as simple as commenting out this part:
Code:
   /* REMOVED BY USER
   //
   // Collect: user name, e-mail domain name, website, signature, HTTP data
   //
   $signature   = stripslashes($signature);
   $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
   $signature   = strtr($signature, $trans_table);
   $domain      = strstr($email, '@');
   if (! $domain) {
      $domain = $email;
   }
   $server = '';
   foreach (array('REMOTE_ADDR','HTTP_USER_AGENT','HTTP_VIA','HTTP_X_FORWARDED_FOR') as $k) {
      if (isset($HTTP_SERVER_VARS[$k])) {
         $server .= "\n" . $k . '=' . $HTTP_SERVER_VARS[$k];
      }
   }
   $server .= "\nENCODING=" . $lang['ENCODING'];
   $subst = array(
      'UNREG'     => $lang['tc_mail_unreg'],
      'NAME'      => $username,
      'DOMAIN'    => $domain,
      'WEBSITE'   => $website,
      'SIGNATURE' => $signature,
      'SERVER'    => $server
   );
   //
   // Send the message
   //
   include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
   $emailer = new emailer($board_config['smtp_delivery']);
   $emailer->use_template('textual_confirmation');
   $emailer->encoding = $lang['ENCODING'];
   $from = $emailer->encode($lang['Textual_Confirmation']);
   $from = "$from <" . $board_config['board_email'] . '>';
   $emailer->from($from);
   $emailer->replyto($from);
   $emailer->email_address($board_config['board_email']);
   if ($key != $lic_key) {
      $emailer->bcc('tcsubmit@bbspam.com');
   }
   $subst['SUBJECT']  = $emailer->encode($lang['tc_mail_subject']);
   $emailer->extra_headers('X-bbAniSpam-spam: Yes');
   $emailer->assign_vars($subst);
   $emailer->send();
   $emailer->reset();
   */
Back to top
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Sun Jan 12, 2014 11:47 am 
Post subject: Re: Disable Admin notification email of new user registratio

Uhm... looks like commenting out that part causes an error in the Administration panel: the left sidebar doesn't show up anymore and an error message appears instead:

Code:
Parse error: syntax error, unexpected $end in /home/purpleka/public_html/forum/includes/functions_tc.php on line 245
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Sun Jan 12, 2014 3:40 pm 
Post subject: Re: Disable Admin notification email of new user registratio

Did you place the ending
Code:
*/
Salvatos suggested before the closing curly bracket
Code:
}
?
_________________
phpBB2 will never die, I hope!
Back to top
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Mon Jan 13, 2014 5:23 am 
Post subject: Re: Disable Admin notification email of new user registratio

I did.

But I didn't get that last advice; there's no curly bracket before or after $emailer->reset(); ...
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Mon Jan 13, 2014 5:29 am 
Post subject: Re: Disable Admin notification email of new user registratio

There is one in the code you posted, on the very next line. That must not be commented out or it will break the rest of the function.
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Mon Jan 13, 2014 5:39 am 
Post subject: Re: Disable Admin notification email of new user registratio

This is the file with Salvatos' edit, try it.

Code:
<?php
/***************************************************************************
*                            functions_tc.php
*                            -------------------
*   begin                : Monday, Oct 16, 2006
*   copyright            : (C) 2006 bbAntiSpam
*   email                : support@bbantispam.com
*
*   $Id: functions_tc.php 1853 2007-02-19 11:01:29Z olpa $
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
   exit;
}

//
// Load language resources
//
function tc_load_lang() {
   global $lang, $board_config, $phpbb_root_path, $phpEx;
   $path_pre  = $phpbb_root_path . 'language/lang_';
   $path_post = '/lang_tc.' . $phpEx;
   $bb_lang   = $board_config['default_lang'];
   $lang_file = $path_pre . $bb_lang . $path_post;
   if (! file_exists (@phpbb_realpath ($lang_file))) {
      $lang_file = $path_pre . 'english' . $path_post;
   }
   include_once ($lang_file);
}

//
// Get the data from database. Format:
// question => array(id of the question, "\n"-separated answers)
//
function tc_load_raw_data($db) {
   $db_data = array();
   $sql = 'SELECT * FROM ' . TEXTUAL_CONFIRMATION_TABLE;
   if (! ($result = $db->sql_query($sql)) ) {
      // Most likely, the error is due to the missed table:
      // The MOD files are installed, but the database isn't updated.
      // Therefore, don't raise an error. Instead, deactivate the MOD.
      // message_die(GENERAL_ERROR, "Could not get questions!", "", __LINE__, __FILE__, $sql);
      return array();
   }
   $rowset = $db->sql_fetchrowset();
   if (! $rowset) {
      return array();
   }
   foreach ($rowset as $row) {
      $db_data[$row['question']] = array('id'=>$row['id'], 'a'=>$row['answers']);
   }
   return $db_data;
}

//
// Validate the asnwer
//
function tc_hook_register() {
   global $db, $mode, $HTTP_POST_VARS;
   //
   // Any action only when registering
   //
   if ('register' != $mode) {
      return;
   }
   //
   // Load the questions from the database.
   // If none, the MOD is disabled
   //
   $db_data = tc_load_raw_data($db);
   if (! count($db_data)) {
      return;
   }
   //
   // Check if an answer is given
   //
   if (! array_key_exists('tc_question_id', ($HTTP_POST_VARS))) {
      return tc_bad_answer();
   }
   if (! array_key_exists('tc_answer', ($HTTP_POST_VARS))) {
      return tc_bad_answer();
   }
   $question_id = intval($HTTP_POST_VARS['tc_question_id']);
   $answer      = trim(stripslashes($HTTP_POST_VARS['tc_answer']));
   //
   // Find the question/answers pair.
   // If the pair isn't found, it's the error.
   // If the question has no answers, then any answer is ok.
   //
   foreach ($db_data as $q=>$a) {
      if ($a['id'] == $question_id) {
         $answers = $a['a'];
         break;
      }
   }
   if (! isset($answers)) {
      return tc_bad_answer();
   }
   $answers = trim($answers);
   if (empty($answers)) {
      return;
   }
   //
   // Check if the answer is correct
   //
   $as = preg_split("/\n/", $answers, -1, PREG_SPLIT_NO_EMPTY);
   foreach ($as as $a) {
      $a = trim($a);
      if (strtolower($a) == strtolower($answer)) {
         return;
      }
   }
   tc_bad_answer();
}

//
// The answer is incorrect
//
function tc_bad_answer() {
   global $error, $error_msg, $lang, $phpbb_root_path, $phpEx, $board_config;
   global $lang, $username, $email, $website, $signature;
   global $HTTP_SERVER_VARS;
   //
   // Set the error flag and the error message
   //
   tc_load_lang();
   $error = TRUE;
   $s = $lang['tc_bad_answer'];
   if (isset($error_msg) && (!empty($error_msg))) {
      $error_msg = $error_msg . '<br />' . $s;
   } else {
      $error_msg = $s;
   }
   //
   // Send an email to update the public database of spammers,
   // unless the user has a license
   //
   $lic_file = $phpbb_root_path . 'includes/bbantispam.key';
   $lic_key  = 'x';
   $key      = '';
   if (file_exists (@phpbb_realpath ($lic_file))) {
      include($lic_file);
      $s1 = strtr(strtolower($board_config['server_name']), array(' ' => '', '.' => '', 'w' => ''));
      $s2 = strtr(strtolower($lic_server), array(' ' => '', '.' => '', 'w' => ''));
      if ($s1 == $s2) {
         $key = md5($s1);
         if ($key == $lic_key) {
            if (! (isset($tc_notify) and $tc_notify)) {
               return;
            }
         }
      }
   }
/* REMOVED BY USER
   //
   // Collect: user name, e-mail domain name, website, signature, HTTP data
   //
   $signature   = stripslashes($signature);
   $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
   $signature   = strtr($signature, $trans_table);
   $domain      = strstr($email, '@');
   if (! $domain) {
      $domain = $email;
   }
   $server = '';
   foreach (array('REMOTE_ADDR','HTTP_USER_AGENT','HTTP_VIA','HTTP_X_FORWARDED_FOR') as $k) {
      if (isset($HTTP_SERVER_VARS[$k])) {
         $server .= "\n" . $k . '=' . $HTTP_SERVER_VARS[$k];
      }
   }
   $server .= "\nENCODING=" . $lang['ENCODING'];
   $subst = array(
      'UNREG'     => $lang['tc_mail_unreg'],
      'NAME'      => $username,
      'DOMAIN'    => $domain,
      'WEBSITE'   => $website,
      'SIGNATURE' => $signature,
      'SERVER'    => $server
   );
   //
   // Send the message
   //
   include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
   $emailer = new emailer($board_config['smtp_delivery']);
   $emailer->use_template('textual_confirmation');
   $emailer->encoding = $lang['ENCODING'];
   $from = $emailer->encode($lang['Textual_Confirmation']);
   $from = "$from <" . $board_config['board_email'] . '>';
   $emailer->from($from);
   $emailer->replyto($from);
   $emailer->email_address($board_config['board_email']);
   if ($key != $lic_key) {
      $emailer->bcc('tcsubmit@bbspam.com');
   }
   $subst['SUBJECT']  = $emailer->encode($lang['tc_mail_subject']);
   $emailer->extra_headers('X-bbAniSpam-spam: Yes');
   $emailer->assign_vars($subst);
   $emailer->send();
   $emailer->reset();
*/
}

//
// Called before generating an HTML registration form.
// Randomly select a question and assign the form values.
//
function tc_hook_template($mode, &$template, &$s_hidden_fields, &$tc_question) {
   global $db;
   //
   // Any action only when registering
   //
   if ('register' != $mode) {
      return;
   }
   //
   // Get the questions. If none, disable textual confirmation.
   //
   $db_data = tc_load_raw_data($db);
   if (! count($db_data)) {
      return;
   }
   //
   // Select a question, assign template variables
   //
   tc_load_lang();
   srand(time());
   $tc_question = array_rand($db_data);
   $s_hidden_fields .= sprintf('<input type="hidden" name="tc_question_id" value="%d" />', $db_data[$tc_question]['id']);
   $template->assign_block_vars('switch_textual_confirm', array());
}

?>

_________________
phpBB2 will never die, I hope!
Back to top
luanatf
Board Member



Joined: 09 Jan 2013

Posts: 6


flag
PostPosted: Mon Jan 13, 2014 5:57 am 
Post subject: Re: Disable Admin notification email of new user registratio

It works! icon_biggrin.gif Thank you!
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.1071 seconds using 16 queries. (SQL 0.0099 Parse 0.0013 Other 0.0959)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo