php实现查看邮件是否已被阅读的方法

yipeiwu_com6年前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);

?>

相关文章

PHP简单开启curl的方法(测试可行) 原创

PHP简单开启curl的方法(测试可行) 原创

本文讲述了PHP简单开启curl的方法。分享给大家供大家参考,具体如下: 一、问题: windows主机出现“Call to undefined function curl_init”错...

php无限分类使用concat如何实现

一、数据库设计 -- -- Table structure for table `category` -- CREATE TABLE `category` ( `...

php实现转换ubb代码的方法

本文实例讲述了php实现转换ubb代码的方法。分享给大家供大家参考。具体如下: function ubb2html($content) { global $article; //是否...

PHP实现QQ空间自动回复说说的方法

本文实例讲述了PHP实现QQ空间自动回复说说的方法。分享给大家供大家参考,具体如下: <?php header("Content-type: text/html; c...

Linux下源码包安装Swoole及基本使用操作图文详解

Linux下源码包安装Swoole及基本使用操作图文详解

本文实例讲述了Linux下源码包安装Swoole及基本使用操作。分享给大家供大家参考,具体如下: 下载Swoole PECL扩展源码包:http://pecl.php.net/pack...