Gossamer Forum
Home : Products : DBMan : Customization :

ip address of record owner

Quote Reply
ip address of record owner
Hi, I search for how to add ip address of record owner on the record long page,and also add ip to the record_added_success sending to mail.
I dont know if this must to make a filed for ip or not?
Thank you for any help posting here.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: ip address of record owner In reply to
In the FAQ noted below under the section "Files / Records" subsection "Records" there is a thread reference called:

How can i store IP address in Database?

I think this might provide the solution you are looking for.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Post deleted by act In reply to
Quote Reply
Re: ip address of record owner In reply to
Hi, I have fixed it.,the next question is how if i want to keep ip as it is after admin modified that record.(still keep the ip updated if users moidfied)
I have this tag in sub html_record_form.
<INPUT TYPE="hidden" NAME="IP" VALUE= "$ENV{REMOTE_ADDR}"> ]

and this in .cfg
IP => [22, 'numer', -1, 60, 0, "$ENV{REMOTE_HOST}", ''],



Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: ip address of record owner In reply to
Try this - add this line to the top of html_record_form:
my $ip_address = (($per_admin) ? $rec{'IP'} : $ENV{REMOTE_ADDR});

Then replace your hidden field with:
<INPUT TYPE="hidden" NAME="IP" VALUE="$ip_address">

That should do it.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: ip address of record owner In reply to
Hi :)
I not try it yet ,bu twant to know what do it mean;
my $ip_address = (($per_admin) ? $rec{'IP'} : $ENV{REMOTE_ADDR});

Does it will not change ip to admin's ip and keep the ip of that record,after admin have modified that record?
Thank you Mark.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: ip address of record owner In reply to
It's an inline if.

Basically it will set $ip_address to the IP Address of the current uer if they are not the admin. Otherwise it will set it to the IP address stored in the database.

So if you're an admin, the IP address will not be updated. If you aren't an admin, it will be updated.

Is that what you wanted?

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: ip address of record owner In reply to
Hi,Mark ,this is work fine :)
what about this line in .cfg
IP => [22, 'numer', -1, 60, 0, "$ENV{REMOTE_HOST}", ''],
$ENV{REMOTE_HOST} keep it or remove it?

Thank you for you help :)



Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: ip address of record owner In reply to
Yes, you should leave that in.

Otherwise, when adding a new record, an IP address won't be stored.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: ip address of record owner In reply to
Thank a lot for your help Mark.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: ip address of record owner In reply to
Hi Mark,
I added new 2 fields ,one is Date_mod field and other is Time_mod field.
this is a question if I would like to keep date and time (they are must be seperated field)when admin login to modify others users's records,then how ?
I have make code in .html at sub html_record_form as below;

#add Date_mod field
$date = &get_date();
#add Time_mod field
$time = &get_time();

and some hidden fileds

if ($per_mod) {
print qq|<INPUT TYPE="hidden" NAME="Date_mod" VALUE="$date">|;
print qq|<INPUT TYPE="hidden" NAME="Time_mod" VALUE="$time">|;
}

but I want it not effect if per_admin.



Please Excuse me for my poor knoledge of PERL
Regards,
Act.