I am implementing a functionality in application where user can transfer money from one person's account to anothers. Once they click on Transfer button after all the account details, I want to get the IP address of the user and to save it in a DB. I am following MVC style and Php to develop this application. I am confused with the flow, I should follow. I have three files: 'view.php' that give the form to enter the details, the controller and the model.
After searching on internet, i found the following way to get the IP address. but I don't know how to send it to database.
$IP = $_SERVER['REMOTE_ADDR'];
Also I find another way using jQuery to get IP address,
$(#transfer).on("click",function(){
$.getJSON("http://jsonip.com/?callback=?", function (ipaddr) {
console.log(ipaddr);
// alert(ipaddr.ip);
});
});
How to send the IP address to my database using any of the above. Need help. Thanks in advance.