Code: Select all
$emailer->set_subject($lang['ACP_Login']);
Code: Select all
$board_config['sitename']
Code: Select all
$emailer->assign_vars(array....
Code: Select all
$emailer->assign_vars(
array(
'USERNAME' => $userdata['username'],
'USERID' => $userdata['user_id'],
'USERIP' => decode_ip($user_ip),
'TIME' => sprintf(
$lang['Current_time'],
create_date(
$board_config['default_dateformat'],
time(), $board_config['board_timezone']
)
)
)
);
Code: Select all
$emailer->assign_vars(
array(
'USERNAME' => $userdata['username'],
'USERID' => $userdata['user_id'],
'USERIP' => decode_ip($user_ip),
'TIME' => sprintf(
$lang['Current_time'],
create_date(
$board_config['default_dateformat'],
time(), $board_config['board_timezone']
)
)
);
Code: Select all
#
#---[ FIND ]-------------------------------------------------
#
//
// Generate relevant output
//
#
#---[ BEFORE, ADD ]---------------------------------------
#
....
Code: Select all
#
#---[ FIND ]-------------------------------------------------
#
if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
#
#---[ AFTER, ADD ]---------------------------------------
#
...
AbelaJohnB wrote: hey Defpm,
Might I suggest the use of another sprintf() function within:
Code: Select all
##############################################################
## MOD Title: Email Admin on ACP Login
## MOD Author: The Defpom < > (Scott Gausden) http://www.radiomods.co.nz
## MOD Description: Adds a feature so that if the ACP is accessed it emails the admin.
## MOD Version: 1.0.2
##
## Installation Level: Easy
## Installation Time: 1 Minutes
## Files To Edit: 2
## admin/index.php
## language/lang_english/lang_main.php
##
## Included Files: 1
## language/lang_english/email/admin_acp_login.tpl
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: Works with Easymod !!
##
## This mod will add a a feature so that if the ACP is accessed by someone other than the main admin it emails the admin to let them know !
## It includes the persons user name, user ID, IP Address and time accessed.
##
## NOTE: it is neccesary to set the required ADMIN user ID in the code below (x2), the default ID is "2", so if the main admin has a different user id
## change the code to the same ID.
##
##
## This MOD can be seen in action on my forum: http://www.radiomods.co.nz/forum/
##
##############################################################
## MOD History:
##
## 04/29/05 - 1.0.2
## - Minor code changes (added missing bracket, added sitename to email, fixed multiple emails)
## 04/13/05 - 1.0.1
## - Minor code fix
## 04/02/05 - 1.0.0
## - Submitted for release
## 03/23/05 - 0.1.1
## - First Version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#---[ COPY ]------------------------------------------------
#
copy language/lang_english/email/admin_acp_login.tpl to language/lang_english/email/admin_acp_login.tpl
#
#---[ OPEN ]------------------------------------------------
#
admin/index.php
#
#---[ FIND ]-------------------------------------------------
#
if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
#
#---[ AFTER, ADD ]---------------------------------------
#
//
//send e-mail to admin on ACP access
//
// The first line below sets the admin account user id, if the ACP is accessed by a different ID it will activate the email feature.
// The default is ID 2 (main ADMIN), if the main admin has a different ID number enter it instead of 2 ie for ID 3 use $userdata['user_id'] != 3
// You will also need to enter the correct admin user ID on the 5th line down (if it is not "2") otherwise it wont email the right person !
// if you want to be emailed for all ACP accesses change code to read: $userdata['user_id'] != 0
if( $userdata['user_id'] != 2 ) //User ID of Admin, checks if the user ID is NOT admin user id, if true it runs the statement.
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$sql = 'SELECT user_email FROM ' . USERS_TABLE . ' WHERE user_id = 2'; //User ID of Admin, you will need to change this if the admins user id is not "2"
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template('admin_acp_login');
$emailer->set_subject($lang['ACP_Login']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'],
'USERID' => $userdata['user_id'],
'USERIP' => decode_ip($user_ip),
'SITENAME' => $board_config['sitename'],
'TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])))
);
}
$db->sql_freeresult($result);
$emailer->send();
$emailer->reset();
}
//
//end send e-mail to admin
//
#
#---[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#---[ FIND ]-------------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#---[ BEFORE, ADD ]---------------------------------------
#
// Email Admin on ACP Login
$lang['ACP_Login'] = 'Someone just accessed the admin control panel !!';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Select all
Charset: iso-8859-1
This is an automated message, {TIME}
Urgent Warning !!
======================================================
A user named: {USERNAME}
With a user ID of: {USERID})
And with the IP Address of: {USERIP}
Just accessed the Admin Control Panel !!!
{SITENAME} should be checked for problems.
=====================================================
The Defpom wrote: Why are you guys suddenly slamming stuff, the mod does work...
The Defpom wrote: it obviously worked for the MOD team as well
The Defpom wrote: plus other users have successfully installed it.
The Defpom wrote: instead of complaining and making accussations, how about you give me some information, to try and work out why it does not work for you
The Defpom wrote: Did you follow the instrustions fully
The Defpom wrote: Did you follow the instrustions fully ?, it will only email the admin if a user OTHER than the admin accesses the ACP, so if you expect an email if you login you WONT GET ONE, UNLESS, you set the user ID to "0" (Zero) so it emails on ALL accesses.
The Defpom wrote: Does your forum use the php mail funtin or does it use SMTP ?
The Defpom wrote: Come on guys, play nice, I did this MOD to help people out
The Defpom wrote: I was not trying to start an argument, so sorry if it appeared that way
The Defpom wrote: If only I had this much feedback when it was posted in the BETA forum !
The Defpom wrote: Thank you for finding the causes of the problems, and the suggested fixes, which were bang on, moving the code segment fixed the triple email issue, you obviously know your stuff.