jeudi 28 juillet 2016

Get users ip on page click

I'm trying to get my users ip address when they open a certain page. I want this ip mailed to me or stored in the database.

At the moment I have this, but its not working.

<?php
$to = "flash1996mph@hotmail.com";
$subject = "test";
$ip = $_SERVER['REMOTE_ADDR'];
$txt = "Hello world!";

header ('mail($to,$subject,$txt,$ip);')
?>

I have no idea if this is right or wrong, I'm just a newby trying.. This was the first that came up in my mind.

All help is appreciated.

Thanks in advance,

-Kev

edit:

<?php
$to = "flash1996mph@hotmail.com";
$subject = "test";
$ip = $_SERVER['REMOTE_ADDR'];
$txt = "Hello world!";

 mail($to,$subject,$txt,$ip); 
?>

Got this now, and its still not working.

Aucun commentaire:

Enregistrer un commentaire