Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Capture an IP Number

Quote Reply
Capture an IP Number
How to capture an IP number when a user submit a site, save it into database and after validated email the add sucess form with the IP number they send the submit site thru.

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture an IP Number In reply to
1) Add Field to your links.def file called IP.
2) Update your database using the upgrade.pl file located in a number of Threads in the Links 2.0 forum.
3) Add the following codes in your sub site_html_add_form and sub site_html_add_failure in the site_html_templates.pl:

Code:

my $ipaddress = $ENV{'REMOTE_ADDR'};


Then define the following tag in these subroutines:

Code:

IP => $ipaddress,


4) Then add a hidden field to your add.html and add_error.html file:

Code:

<input type="hidden" name="IP" value="<%IP%>">


That should take care of storing the IP address...although be aware that IP addresses are not the most reliable data to record your visitor's activities, since IP addresses are assigned dynamically via most dialup connections.


Now for the second part of your request...I don't really understand what you want to do.

Regards,

Eliot Lee


Quote Reply
Re: Capture an IP Number In reply to
Dear Eliot,

Second part:
When a user submits their link, I need to validate it in my Admin area, so after I validate the link, Links 2.0 will send a confirmation mail to their mailbox with all the details of their submission including the link ID, what I want to do is to display the IP number in the same form.


Thanks for your tricks,

N. Duque

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture an IP Number In reply to
In Reply To:
Links 2.0 will send a confirmation mail to their mailbox with all the details of their submission including the link ID, what I want to do is to display the IP number in the same form.
Well...the confirmation message is already built into Links 2.0...If you want to send the IP address with the confirmation message AFTER you validate the links, then simply follow the suggestions I gave for adding a new field in your links.db...

Then simply add the following tag in the email-add.txt file:

Code:

<%IP%>


Regards,

Eliot Lee


Quote Reply
Re: Capture an IP Number In reply to
Dear Eliot,

Thanks a lot

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture an IP Number In reply to
Dear Eliot Lee,

I've already tried the steps you gave me, but I can't make it work. Can you give me some more details, specially how to add the field for IP in links.def, 'number' or 'alpha' and spaces, I add a field as follow, but it doesn't work:
IP => [8, 'numer', 20, 20, 1, '', ''],

How to store it in links.db?
Sorry for wasting your valuable time.

Best regards,

Nuno Duque

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture an IP Number In reply to
Use alpha, since there will be dots (like 128.123.12.12).

Code:

IP => [8, 'alpha', 20, 20, 1, '', ''],


Remember that you need to upgrade your current database by using the upgrade.pl that is linked in quite a few Threads in the Links 2.0 forums...

AND please use the forum search engine to find Threads that discuss adding fields. Have you even tried using the search engine or looking in the FAQ section in the Resource Center? Well, you should. Wink

Regards,

Eliot Lee


Quote Reply
Re: Capture an IP Number In reply to
Dear Eliot Lee,

Thanks for your reply, I think you're our god of programming.

I will try it!


Thanks,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com