PHP實現查看郵件是否被閱讀
?
<?
//當你在發送郵件時,你或許很想知道該郵件是否被對方已閱讀。這裏有段非常有趣的代碼片段能夠顯示對方IP地址記錄閱讀//的實際日期和時間。
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);
?
?>
?
文章來源:劉俊濤的博客
地址:http://www.cnblogs.com/lovebing
歡迎關註,有問題一起學習歡迎留言、評論。
PHP實現查看郵件是否被閱讀