Announcement

Collapse
No announcement yet.

How to add IP address & hostname to admin registration notify email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to add IP address & hostname to admin registration notify email

    I know that I have to edit the "email_newuser" template, but what variables should I use to have the new users ip address & hostname included in this message. I find this information very helpful when troublesome users insist on re-registering after they have had their posting rights revoked.
    Steve

    F150online Forums - 92,000 users strong and growing!
    Ownersite.com - comprehensive preventive maintenance reminder & expense tracking system for the conscientious vehicle owner.


  • #2
    $REMOTE_ADDR and I can't remember the hostname variable (if there is one) -- you might have to gethostbyaddr() the $REMOTE_ADDR to get it.

    Comment


    • #3
      That did it...

      Thanks Ed.

      Since my server is set up to resolve host names, the two variables are:

      $REMOTE_ADDR and $REMOTE_HOST

      Does that mean that I can use any environmental variable in vB templates in this manner?
      Steve

      F150online Forums - 92,000 users strong and growing!
      Ownersite.com - comprehensive preventive maintenance reminder & expense tracking system for the conscientious vehicle owner.

      Comment


      • #4
        In most. You might have to use $GLOBALS[REMOTE_ADDR] and $GLOBALS[REMOTE_HOST] in a few. (Not 100% if those work -- haven't tested them).

        Comment


        • #5
          My server is set not to reverse-lookup (it's supposed to add extra strain to the server, so I didn't enable that bit).

          If yours is like mine, then don't worry - follow these steps to hack this functionality in. Don't forget to take a backup of register.php before you edit it.

          1. Open register.php
          2. Search for eval("\$message = \"".gettemplate("email_newuser",1,0)."\";");
          3. In the line immediately above it, add:
          $hostaddress=gethostbyaddr($ipaddress);
          4. Save, close and upload register.php
          5. Go into your control panel's templates and edit email_newuser
          6. Add the following lines where you want them to appear:
          IP address: $REMOTE_ADDR
          IP host: $hostaddress

          7. Hit "Save changes".

          Hey presto; you'll now get the IP address and the hostname in your registration e-mails.

          I've documented this here primarily so that I don't fall into the trap of hacking code and then having awful problems putting undocumented hacks back into the upgrade, but I hope others find it useful (and that I've not broken any rules!)

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X