mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-05-17 02:42 am

[dw-free] log IPs for all orders

[commit: http://hg.dwscoalition.org/dw-free/rev/019a523054f5]

http://bugs.dwscoalition.org/show_bug.cgi?id=1049

Log IP address used to create shopping carts, and then display IP+uniq in
the admin page.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Shop/Cart.pm
  • htdocs/admin/pay/view.bml
--------------------------------------------------------------------------------
diff -r 1157d6f4248d -r 019a523054f5 cgi-bin/DW/Shop/Cart.pm
--- a/cgi-bin/DW/Shop/Cart.pm	Sun May 17 02:28:08 2009 +0000
+++ b/cgi-bin/DW/Shop/Cart.pm	Sun May 17 02:42:16 2009 +0000
@@ -168,6 +168,7 @@ sub new_cart {
         starttime => time(),
         userid    => $u ? $u->id : undef,
         uniq      => LJ::UniqCookie->current_uniq,
+        ip        => BML::get_remote_ip(),
         state     => $DW::Shop::STATE_OPEN,
         items     => [],
         total     => 0.00,
@@ -383,6 +384,7 @@ sub starttime{ $_[0]->{starttime}       
 sub starttime{ $_[0]->{starttime}          }
 sub age      { time() - $_[0]->{starttime} }
 sub items    { $_[0]->{items} ||= []       }
+sub ip       { $_[0]->{ip}                 }
 sub uniq     { $_[0]->{uniq}               }
 sub nextscan { $_[0]->{nextscan}           }
 sub authcode { $_[0]->{authcode}           }
diff -r 1157d6f4248d -r 019a523054f5 htdocs/admin/pay/view.bml
--- a/htdocs/admin/pay/view.bml	Sun May 17 02:28:08 2009 +0000
+++ b/htdocs/admin/pay/view.bml	Sun May 17 02:42:16 2009 +0000
@@ -110,6 +110,8 @@ EOF
     $body .= "<tr><th>Date:</th><td>" . DateTime->from_epoch( epoch => $cart->starttime )->strftime( "%F %r %Z" ) . "</td></tr>";
     $body .= "<tr><th>Total:</th><td>\$" . $cart->total . " USD</td></tr>";
     $body .= "<tr><th>Payment Method:</th><td>$paystr</td></tr>";
+    $body .= "<tr><th>Uniq:</th><td>" . $cart->uniq . "</td></tr>";
+    $body .= "<tr><th>IP:</th><td>" . $cart->ip . "</td></tr>";
     $body .= "<th>Status:</th><td>$ML{\"/shop/receipt.bml.cart.status.$state\"}</td></tr>";
     $body .= "</table>";
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org