View Full Version : Inserting user IP address into MySQL DB

Feb 24th, 2012, 08:27 AM
var ip = '<!--#echo var="REMOTE_ADDR"-->';

I'm sending the above via a GET to a php file that inserts into a DB.

here is the php portion


$sql="INSERT INTO statcounter (selection, ip) VALUES ('".$q."','".$ip."')";

It is inserting properly into the DB, but the IP isn't correct. In the IP field I'm getting "<!--" instead of the users IP address. Would anyone have any advice on this?

I took the first line from this website
Apparently they were able to get the IP from only using

var ip = '<!--#echo var="REMOTE_ADDR"-->';

But I'm not sure how they were able to do this

Feb 24th, 2012, 12:26 PM
var ip = '<!--#echo var="REMOTE_ADDR"-->'; What's that language?