Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

http_x_forwarded_for how to show in Admin for a given user?

Quote Reply
http_x_forwarded_for how to show in Admin for a given user?
I am able to get the data added to user_logins table HTTP_X_FORWARDED_FOR (column added and Auth.pm modified). How do i get it to display alongside the IP Address in the Admin for any given user. The tables have the data but unable to get it displayed in the Admin section (Modify link).

Anup
Quote Reply
Re: [anup123] http_x_forwarded_for how to show in Admin for a given user? In reply to
The following as suggested By Chaz, got it to display the same :

/Gmail/SQL/Admin.pm

--- Admin.pm Wed Dec 10 15:40:00 2003
+++ Admin.pm Sat Jan 3 04:59:10 2004
@@ -843,25 +843,36 @@
print qq|<table border=1 cellpadding=0 cellspacing=0>
<tr><td>
<table border=0 width=500>
- <tr><td colspan=2 bgcolor=navy>
+ <tr><td colspan=3 bgcolor=navy>
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">User Login History (last 10 logins)</font>
</td></tr>
- <tr><td>
- <font face="Tahoma,Arial,Helvetica" size=2><b>Date</b></font>
- </td>
- <td>
- <font face="Tahoma,Arial,Helvetica" size=2><b>IP Address</b></font>
- </td></tr>|;
+ <tr>
+ <td><font face="Tahoma,Arial,Helvetica" size="2"><b>Date</b></font> </td>
+ <td align="center"><font face="Tahoma,Arial,Helvetica" size="2"><b>IP Address</b></font> </td>
+ <td align="center"><font face="Tahoma,Arial,Helvetica" size="2"><b>Lan Address</b></font></td>
+ </tr>|;

- my %history = $DB->table('user_logins')->select("user_logins_date", "user_logins_ip", { user_logins_userid => $values->{$GT::SQL::PREFIX . 'users.userid'} })->fetchall_list();
+my $history = $DB->table('user_logins')->select("user_logins_date", "user_logins_ip", "user_logins_lan", { user_logins_userid => $values->{$GT::SQL::PREFIX . 'users.userid'} })->fetchall_hashref;

- if (! keys %history) {
+ if (!$history) {
print qq|<tr><td><font face="Tahoma,Arial,Helvetica" size=2><i>Never logged in</i></font></td></tr>|;
}
else {
- for (sort { $a <=> $b } keys %history) {
- print qq|<tr><td valign=top align=left width='30%'><font face="Tahoma,Arial,Helvetica" size=2><nobr>| . GT::Date::date_get($_, $CFG->{date_admin_format}) . qq|</nobr></font></td><td valign=top align=left width='70%'><font face="Tahoma,Arial,Helvetica" size=2>$history{$_}</font></td>|;
- }
+for (sort { $a->{user_logins_date} <=> $b->{user_logins_date} } @$history) {
+ print qq|
+ <tr>
+ <td valign=top align=left width='30%'>
+ <font face="Tahoma,Arial,Helvetica" size=2><nobr>| . GT::Date::date_get($_->{user_logins_date}). qq|</nobr></font>
+ </td>
+ <td valign=top align=left width='40%'>
+ <font face="Tahoma,Arial,Helvetica" size=2>$_->{user_logins_ip}</font>
+ </td>
+<td valign=top align=left width='40%'>
+ <font face="Tahoma,Arial,Helvetica" size=2>$_->{user_logins_lan}</font>
+ </td>
+ </tr>|;
+}
+
}

print qq|</table></table></p>|;



Thnx

Anup