Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Getting IP address displayed in the registration admin notification message  (Read 5067 times)

0 Members and 1 Guest are viewing this topic.

mr5

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49

Hi, couldn't find the answer to that.
Lately some (probably unwanted) users have registered into my gallery. I would like to compare their IP addresses. For that it would be very useful to add IP address to the notification msg, like: "A new user with the username "nn" (IP=xxxxx) has registered in your gallery". 
Thanks
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.

There are a couple of files that need to be edited to accoplish this.

First edit your lang file. ie: lang/english.php
Find:
Code: [Select]
$lang_register_approve_email = <<< EOTadd
Code: [Select]
IP: {RAW_IP}wherever you want inside of the heredoc, the EOT tags.

Next edit register.php.
Find:
Code: [Select]
function check_user_info(&$error)In the global variables add $raw_ip
Code: [Select]
global $lang_register_user_login, $lang_errors, $raw_ip;
In the same function
Find this twice:
Code: [Select]
$template_vars = array(
            '{SITE_NAME}' => $CONFIG['gallery_name'],
            '{USER_NAME}' => $user_name,
            '{ACT_LINK}'  => $act_link,
        );
and replace with:
Code: [Select]
$template_vars = array(
            '{SITE_NAME}' => $CONFIG['gallery_name'],
            '{USER_NAME}' => $user_name,
            '{ACT_LINK}'  => $act_link,
            '{RAW_IP}'    => $raw_ip,
        );
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

mr5

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49
Logged

mr5

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49

Sorry to come back to this. The fix probably works when registration needs admin approval. But in my case the admin does not have to approve and it looks that we don't reach $lang_register_approve_email = <<< EOT line.
Thanks.
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.

Try this.

In lang/english.php
Find:
Code: [Select]
$lang_register_php['notify_admin_email_body'] = 'A new user with the username "%s" has registered in your gallery';Change to:
Code: [Select]
$lang_register_php['notify_admin_email_body'] = 'A new user with the username "%s" with an IP of %s has registered in your gallery';
In register.php (the same function as the last post function check_user_info(&$error))
Find
Code: [Select]
cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name));replace with
Code: [Select]
cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name, $raw_ip));
make sure you leave $raw_ip in the functions global varabiles.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

mr5

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49

 :) Thanks Jeff, bot cases work!
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Happykeppi

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Getting IP address displayed in the registration admin notification message
« Reply #7 on: September 28, 2012, 01:06:44 pm »

Sorry to bump this thread, but I'm interested in the same feature and made the above mentioned edits to the corresponding files (language files / register.php). Unfortunately, it's not working as it should since the variable for the ip address isn't resolved and I only see "IP: {RAW_IP}" (in plain text) in the confirmation message. Has anyone an idea what goes wrong here?
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.

Reread the thread, looks like you missed this part.
Edit register.php.
Find:
Code: [Select]
function check_user_info(&$error)In the global variables add $raw_ip
Code: [Select]
global $lang_register_user_login, $lang_errors, $raw_ip;
In the same function
Find this twice:
Code: [Select]
$template_vars = array(
            '{SITE_NAME}' => $CONFIG['gallery_name'],
            '{USER_NAME}' => $user_name,
            '{ACT_LINK}'  => $act_link,
        );
and replace with:
Code: [Select]
$template_vars = array(
            '{SITE_NAME}' => $CONFIG['gallery_name'],
            '{USER_NAME}' => $user_name,
            '{ACT_LINK}'  => $act_link,
            '{RAW_IP}'    => $raw_ip,
        );

Please start your own threads and post a link in the future.
http://forum.coppermine-gallery.net/index.php?index.php/topic,55415.0.html
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.