PHP method to check whether the email has been read_PHP tutorial

WBOY
Release: 2016-07-13 17:17:58
Original
953 people have browsed it

When you send an email, you may want to know whether the email has been read by the other party. Here’s a very interesting snippet of code that displays the actual date and time the record was read by the other party’s IP address.

Copy code The 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 . ' ' . "rn";
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);

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/621706.htmlTechArticleWhen you send an email, you may want to know whether the email has been read by the other party. Here is a very interesting code snippet that displays the actual date and time the IP address record was read...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!