Add reverse DNS in registration notification
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 25 May 2007 20:54:10 +0000 (20:54 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 25 May 2007 20:54:10 +0000 (20:54 +0000)
 classes/corelogger.php |   14 ++++++++++++++
 modules/register.php   |    5 ++---
 2 files changed, 16 insertions(+), 3 deletions(-)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1837 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/corelogger.php
modules/register.php

index e5784c6..611a7b1 100644 (file)
@@ -28,6 +28,11 @@ class CoreLogger
     /** list of available actions */
     private $actions;
 
+    public $ip;
+    public $host;
+    public $proxy_ip;
+    public $proxy_host;
+
     /** The constructor, creates a new entry in the sessions table
      *
      * @param $uid the id of the logged user
@@ -73,6 +78,15 @@ class CoreLogger
         XDB::execute("INSERT INTO logger.sessions
                          SET uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
                      $uid, $host, $ip, $forward_ip, $forward_host, $browser, $suid, $proxy);
+        if ($forward_ip) {
+            $this->proxy_ip = $ip;
+            $this->proxy_host = $host;
+            $this->ip = $forward_ip;
+            $this->host = $forward_host;
+        } else {
+            $this->ip = $ip;
+            $this->host = $host;
+        }
 
         return XDB::insertId();
     }
index 1a58b3a..625b221 100644 (file)
@@ -355,9 +355,8 @@ class RegisterModule extends PLModule
                  . " - forlife   : $forlife\n"
                  . " - email     : $email\n"
                  . " - sexe      : $femme\n"
-                 . " - ip        : " . (@$_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['HTTP_X_FORWARDED_FOR']
-                                                                          : $_SERVER['REMOTE_ADDR']) . "\n"
-                 . " - proxy     : " . (@$_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['REMOTE_ADDR'] : "") . "\n";
+                 . " - ip        : {$logger->ip} ({$logger->host})\n"
+                 . ($logger->proxy_ip ? " - proxy     : {$logger->proxy_ip} ({$logger->proxy_host})\n" : "");
             $mymail->setTxtBody($msg);
             $mymail->send(); 
         }