Forums

How to write the IP into the databae

vampmaster 09 May, 2014
Hello all.

I know that when I recived the mail from the form, the servers IP is listed at the button of the table. Is there a way to register that IP into the database, or Better Yet. Is there a way to use a Geolocalizator to check that IP an write the Geolocalization and IP into the database...
ANY HELP WILL BE HIGHLY APRECIATED
GreyHead 10 May, 2014
Hi vampmaster,

Yes it is possible. In CFV4 the IP address is only looked up in the course of the Email so is not available to later actions. I guess that CFV5 is the same.

You'd have to use a Custom Code action to get the IP Address (the code is in the Email action) and add any extra code to do GeoLocation.

Bob

PS I'm not over-impressed with geo-location from IP addresses as they usually mis-place me by several hundred miles.
Max_admin 11 May, 2014
Hi,

Regarding the database save part, If your database table has a field named "ip" (you can add it when you create the table or modify your table in phpmyadmin) then just as a "custom code" atcion before the "db save" action and use the code below:

<?php
$form->data["ip"] = $_SERVER["REMOTE_ADDR"];


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.