
Code: Select all
//
//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, user_timezone, user_dateformat 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($row['user_dateformat'], time(), $row['user_timezone'])))
);
}
$db->sql_freeresult($result);
$emailer->send();
$emailer->reset();
}
//
//end send e-mail to admin
//
Code: Select all
if( $userdata['user_id'] != 2 )
Code: Select all
if( $userdata['user_id'] != 5 )
Code: Select all
$sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE . ' WHERE user_id = 2'; //User
Code: Select all
$sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE . ' WHERE user_id = 5'; //User