<?PHP 
$fromName = 'Progress';
$subject = 'a visit to the Chemin page from ' .  $_SERVER["REMOTE_ADDR"] ;
/* Mail Address */
$toAddr = 'carl@oppedahl.com'; 
$fromAddr = 'carl@oppedahl.com';
/* End Mail Address */
/* Mail Body */
$msg = "We have a visit from " .  $_SERVER["REMOTE_ADDR"] ."\n" .
	"Referer " . $_SERVER['HTTP_REFERER'] ."\n" . 
	"User agent " . $_SERVER["HTTP_USER_AGENT"] ."\n"  ;

require_once('geoplugin.class/geoplugin.class.php');
$geoplugin = new geoPlugin();
// If we wanted to change the base currency, we would uncomment the following line
// $geoplugin->currency = 'EUR';
$geoplugin->locate($_SERVER['REMOTE_ADDR']);
$msg = $msg . 
	"City: {$geoplugin->city} \n".
	"Region: {$geoplugin->region} \n".
	"Country Name: {$geoplugin->countryName} \n".
	"Country Code: {$geoplugin->countryCode} \n".
	"Area Code: {$geoplugin->areaCode} \n".
	"Currency Code: {$geoplugin->currencyCode} \n".
	"Exchange Rate: {$geoplugin->currencyConverter} \n".
	"Map:  https://www.google.com/maps/place/{$geoplugin->latitude},{$geoplugin->longitude} \n";
$msg = $msg . "Host:  " . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n";
$msg = wordwrap($msg, 70);
/* End Mail Body */
/* Mail Headers Setup */
//echo $msg;
$headers = array();
$headers[] = "From: ".$fromName." <carl@oppedahl.com>"; 
/* End Mail Headers Setup */ 
mail($toAddr, $subject, $msg, implode("\r\n", $headers)); 
?>
