Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Anyway to have the submitters IP address recorded?

Quote Reply
Anyway to have the submitters IP address recorded?
I'm looking to have the submitter's IP recorded along with their submit info.

If the form was in php then I could do it with $REMOTE_ADDR but the form is cgi so I have no idea how to do this or if it is even posable.
---
I'm a very boring lady, very, very boring.
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
In theory, it could be done by adding a new field called "SubmittedIP". Then, write a plugin to hook in on the user_add hook, and populate the value with $ENV{'REMOTE_ADDR'}. Wish I had more time... as it shouldn't take more than a 20-30 mins to write Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
Try a Global:

sub {
return $ENV{REMOTE_ADDR}
}

Have a column to store this.
Use tags to have the value inserted.
Should work though never tried in LSQL

Go a step ahead with a second global:

sub {
return $ENV{HTTP_X_FORWARDED_FOR}
}

And u could perhaps also store the same (if available), if the Link Owner is using a connection of that sorts.

HyTC

Last edited by:

HyperTherm: Oct 10, 2004, 9:34 AM
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
I found a few mins ... in fact, 5 mins :)

Give the attached a go (it will add a new field: IPAddress, which should be populated when someone submits a link via add.cgi).

Enjoy!

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Anyway to have the submitters IP address recorded? In reply to
See i saved you 25 cool minutes
:D:D

HyTC
Quote Reply
Re: [HyperTherm] Anyway to have the submitters IP address recorded? In reply to
Doesn't seem to be working but I'm not really sure what I should be adding to the code on the form.

I tried this
<input name="RecordIP" value="<%if RecordIP%><%RecordIP%><%endif%>" >

And this
<input name="RecordIP" value="$ENV{'REMOTE_ADDR'}" >

The drop down menu is showing up in my admin. Actually a text field would be better so that I could do a copy and paste.
---
I'm a very boring lady, very, very boring.
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
If you are trying the global route, try passing the values as hidden form fields. Why would u want to display the same to a guy submitting the details.

I think you would need to edit the template :include_form.html
This would perhaps take care of both add and modify.

BTW, you would have to create a global first. For example:

remote_ip ==>
sub {
return $ENV{REMOTE_ADDR}
}

Then in your template do something like this:

<input type="hidden" name="column_name" value="<%remote_ip%>">

or something similar.

HyTC

Last edited by:

HyperTherm: Oct 10, 2004, 12:02 PM
Quote Reply
Re: [HyperTherm] Anyway to have the submitters IP address recorded? In reply to
OK I feel dumb…
Where or in what file should I create this Global?
---
I'm a very boring lady, very, very boring.
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
Login to Admin
Build>Template Globals

Select the template set that you are using from the drop down list.
Then scroll right down

Left Box (Name for yr global : say remote_ip)
Right Box, paste the following:

sub {
return $ENV{REMOTE_ADDR}
}


Hit Save

Then in a template you would call like this

<%remote_ip%>
would/should display the value

You can try this out and let me know if it works. I am too bloody busy with server upgrades to really try it now or else i would have verified the same before posting.

HyTC

Last edited by:

HyperTherm: Oct 10, 2004, 1:46 PM
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
OK

Midway through, i just tested and found that yes the value is displayed on Add and Modify. So you would need to pass it as a hidden form field, put it up in include_form.html and it shoould work both on Add and Modify...

Aafter having added column to Links table (say Remote_IP)
Put this in include_form.html

<input name="Remote_IP" value="<%remote_ip%>" type="hidden">

You should see the IP in source of the Page (Add and Modify)
Then Submit a test link to see if it gets added to DB


Best Luck

HYtC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Oct 10, 2004, 2:37 PM
Quote Reply
Re: [HyperTherm] Anyway to have the submitters IP address recorded? In reply to
Got it :)

I did have to change "Form Type" to text area from a drop down menu in Links Properties which is better anyway.

This script rocks, thanks for all the help. I love learning new stuff.
---
I'm a very boring lady, very, very boring.
Quote Reply
Re: [Cleo_] Anyway to have the submitters IP address recorded? In reply to
Glad that you succeded. I am learning server administration :)
Know nothing of Perl. Just posted while the compiles were on :)
I am sure that the same is not being displayed on the form as text area or something as the user would change it by typing some value (though hidden fields can also be circimvented but that would need more work that just typing out the values).


HyTC
Quote Reply
Re: [HyperTherm] Anyway to have the submitters IP address recorded? In reply to
Yeah I had something like this on my old form in a hidden field but the page was a shtml page so it was very easy to do.

I just had this in a visible field while setting it up so that I could see if it was working without having to view source.
---
I'm a very boring lady, very, very boring.