I got a question if i write a code to detect IP address can it automatic write down in to the php text field form and send it to the mail function. Can provide the code for more understanding

That should do it.

Whack that in your script :)

mail( 'your@email.addr', 'IP Address', $_SERVER['REMOTE_ADDR'] );

It wouldn't be a huge surprise if a message like that ended up in your spam folder, so watch out for that.

Might want to add some more text to it to try and avoid that :)

$ip=$_SERVER;

in php

I got a question if i write a code to detect IP address can it automatic write down in to the php text field form and send it to the mail function. Can provide the code for more understanding

I can see the results of this code
the google bot finds the site and you get 900 emails from yourself in 45 seconds,
your home ISP adds your commercial site to the blacklist as a spammer
and you never receive another email.
The blacklist gets propogated around the web, and you cant be located.
not perhaps a perfect solution to the issue of data tracking

Why not read your server logs with AwStats
or if you dont have server log access install bbclone or another php monitoring system, or
write something like this scrap "stats.php"

<?php //stats.php  user-file access stats.
$getdate = date( 'd-m-Y, H:i:s' );// Get the date & time
$user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
$user_browser = $_SERVER['HTTP_USER_AGENT'];// Get the browser type.
$referer = $_SERVER['HTTP_REFERER'];// Get the refering page.
$opened = $_SERVER['PHP_SELF']; //get the current filename
$file = "./logfiles/logfile.csv";// Look for the text file - define the text file.
$fp = fopen($file, "a+");//open the text file for writing.
fputs ($fp, "$user_ip, $getdate, $referer, $opened, $user_browser\n"); // Write the user stats into the text file.
fclose($fp);// Close the text file.
?>

with <?php include('stats.php'); ?> in files you want monitored
and just mysite.com/logfiles/logfile.csv when you want to see whats hitting where (opens by default as a spreadsheet comma separated values)

I have no access to server logs and get great results from the scrap on my private site, and bbclone on my "commercial" site

edit logfiles.csv has to be CHMOD writeable

This article has been dead for over six months. Start a new discussion instead.