Gossamer Forum
Quote Reply
how to record IP
Please does anyone know how to record the IP of everyone who will submit a link?
I have been searching this forum for, but there is nothing relevant.

Thanks
Quote Reply
Re: [modifier] how to record IP In reply to
I think you would just need to add a new field to the database and add a new hidden input to the add form containing $ENV{'REMOTE_HOST'} or $ENV{'REMOTE_ADDR'}. Maybe you don't even need it in the database - you might just want to add it to the email that you receive?
Quote Reply
Re: [afinlr] how to record IP In reply to
thanks afinlr
Quote Reply
Re: [modifier] how to record IP In reply to
Hi,

This may help;

http://www.gossamer-threads.com/...orum.cgi?post=273511

Basically, you add a field in lsql_Links called "SubmittersIP", and then use the following global;

Code:
sub { return $ENV{REMOTE_ADDR} }

Save this as "record_ip", and then in include_form.html, put something like;

Code:
<%if SubmittersIP%>
<input type="hidden" value="<%SubmittersIP%>" name="SubmittersIP">
<%else%>
<input type="hidden" value="<%record_ip%>" name="SubmittersIP">
<%endif%>

Hope that helps.

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] how to record IP In reply to
Thanks Andy it’s what I was looking for.
Quote Reply
Re: [Andy] how to record IP In reply to
I can’t make this work. I have read the other thread and tried it also. What kind of setting do I use when creating the new field
”Field Type Length/Set Attributes Null Default Extra” I was trying text, but it did not let me set the Length/Set. It always showed an error:

MySQL said: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(22) not null' at line 1.

Query: ALTER TABLE lsql_Links CHANGE Remote_IP Remote_IP TEXT(22) not null
I have tried couple combination that didn’t show the error, but than it was not working anyway. It only shows 0 in this field.
Quote Reply
Re: [modifier] how to record IP In reply to
Try

Type: CHAR
Length: 255
Regex: ^\d+\.\d+\.\d+\.\d+$

Hope that helps :)

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] how to record IP In reply to
Sorry I can’t make this work.
What is Regex: ^\d+\.\d+\.\d+\.\d+$ ?
Quote Reply
Re: [Andy] how to record IP In reply to
   
Is there anyone who tried this?
I feel dumb… Hey Andy this would be a nice little free plug-in you could write while you are on a lunch brake. Tongue
Quote Reply
Re: [modifier] how to record IP In reply to
Lazy Wink

I've attached a quick plugin. Should do what you want :) Just install it, and then the IPAddress field will get updated along with the submission :)

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!