When you send an email, you may want to know whether the email has been read by the recipient. Here is a very interesting code snippet that shows the actual date and time when the recipient's IP address records are read.
Copy codeThe Code is as follows:
<?
Error_reporting (0 );
Header ("Content-Type: image/jpeg ");
// Get IP
If (! Empty ($ _ SERVER ['HTTP _ CLIENT_IP '])
{
$ Ip = $ _ SERVER ['HTTP _ CLIENT_IP '];
}
Elseif (! Empty ($ _ SERVER ['HTTP _ X_FORWARDED_FOR '])
{
$ Ip = $ _ SERVER ['HTTP _ X_FORWARDED_FOR '];
}
Else
{
$ Ip = $ _ SERVER ['remote _ ADDR '];
}
// Time
$ Actual_time = time ();
$ Actual_day = date ('Y. m. D', $ actual_time );
$ Actual_day_chart = date ('d/m/Y', $ actual_time );
$ Actual_hour = date ('H: I: s', $ actual_time );
// GET Browser
$ Browser = $ _ SERVER ['HTTP _ USER_AGENT '];
// LOG
$ MyFile = "log.txt ";
$ Fh = fopen ($ myFile, 'a + ');
$ StringData = $ actual_day. ''. $ actual_hour.''. $ ip. ''. $ browser.''. "\ r \ n ";
Fwrite ($ fh, $ stringData );
Fclose ($ fh );
// Generate Image (Es. dimesion is 1x1)
$ Newimage = ImageCreate (1, 1 );
$ Grigio = ImageColorAllocate ($ newimage, 255,255,255 );
ImageJPEG ($ newimage );
ImageDestroy ($ newimage );
?>