[2.0.17] Email Admin on ACP Login

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
4
33%
Very Good
1
8%
Good
2
17%
Fair
1
8%
Poor
4
33%
 
Total votes: 12

internetbrother
Registered User
Posts: 230
Joined: Mon Mar 28, 2005 6:30 pm

Post by internetbrother »

I installed this mod and I wait until some body comes it to see if it works :wink:
NightriderXP
Registered User
Posts: 1418
Joined: Sat Oct 09, 2004 8:17 am
Location: Florida, US
Contact:

Post by NightriderXP »

It works for me. I modified it a bit so that it would notify both admins on my board whenever anyone enters the ACP, including both admins...

:lol:
DJ GRINGO
Registered User
Posts: 15
Joined: Sat Apr 09, 2005 6:55 pm
Contact:

Post by DJ GRINGO »

WHICH OF ALL THE CODES IS THE RIGHT ONE I GOT THIS ONE FROM POST PAGE 3

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 
//
IS THIS ALL I NEED TO CHANGE BECAUSE MY ID IS 5
if( $userdata['user_id'] != 2 )
DJ GRINGO
Registered User
Posts: 15
Joined: Sat Apr 09, 2005 6:55 pm
Contact:

Post by DJ GRINGO »

Still no one help me here this module actulaly never work for me
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Post by stickerboy »

if your user_id is 5, then yes change

Code: Select all

if( $userdata['user_id'] != 2 )
to

Code: Select all

if( $userdata['user_id'] != 5 )
in the code you posted it does tell you that :roll:

*Edit*
also change

Code: Select all

       $sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE . ' WHERE user_id = 2'; //User 
to

Code: Select all

       $sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE . ' WHERE user_id = 5'; //User 
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
loulou
Registered User
Posts: 62
Joined: Wed Feb 18, 2004 9:55 pm

Post by loulou »

Is the version of this mod on the download page the current, working version? I mean, is it ok to download this mod there?
Rossdundee
Registered User
Posts: 13
Joined: Fri Jul 14, 2006 8:14 pm

Post by Rossdundee »

What I'd like is an alert for when ANYONE tries to login to admin/index.php

At the moment, users get a "You are not authorised" message if they are not admin, therefore, no access, therefore NO MAIL ALERT.

How can this code be modified to alert whenever a non-admin tries to login?

Ross
Post Reply

Return to “[2.0.x] MOD Database Releases”