I am working on a email system which will record the date and customers ID to MySQL when customers open the HTML email i sent to. The idea is to add a image link in the HTML email and the page will load image from my php page. In my php page, i will create images and record information to database. Every thing works but there is one problem. The outlook will load all the images in one time; therefore, the result wont' be accurate. For example, customers could open the HTML email for 10 times from Outlook but i only record 1 time. I removed the cookie in my browser and every thing works perfect. However, can i disable/delete the cookie in client side? I post some codes here to give you guys an idea.
Here is part of my email send function:
Code: Select all
session_start();
require_once("db_cns.php");
require_once("Mime/Mime/Mime.php");
require_once("Mail/Mail/Mail.php");
//get all the information for HTML email
$message=$HTTP_SESSION_VARS['message'];
$subject=$HTTP_SESSION_VARS['subject'];
$content=$HTTP_SESSION_VARS['content'];
$emaillist=$HTTP_SESSION_VARS['emaillist'];
$user=$HTTP_SESSION_VARS['user'];
$idlist = $HTTP_SESSION_VARS['idlist'];
$emailsize = $HTTP_SESSION_VARS['emailsize'];
$hdrs = array(
'From' => $user,
'Subject' => $subject
);
$crlf = "\r\n";
$mime = new Mail_mime($crlf);
$j=0;
// send HTML email
while($j<$emailsize)
{
$link = "<img src=\"http://10.10.0.31/email/email/test.php?cid=".$idlist[$j]."\" >";
$htmlcontent = $content.$link;
$mime->setHTMLBody($htmlcontent);
$mime->setTXTBody($message);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send("client@hotmail.com", $hdrs, $body);
$j++;
}
?>Code: Select all
<?php
include "db_cns.php";
//create image
header('Content-type: image/jpeg');
$images = imagecreatefromjpeg("image/space.jpg");
imagejpeg($images);
//store information to database
$clientid = $cid;
$time = date("F j, Y, g:i a"); echo "date:".$time;
$query = "INSERT INTO `record` VALUES ('','$time','$cid')";
$result=mysql_query($query);
if (!$result)
{
echo 'ERROR!';
exit;
}Code: Select all
tags when posting code. [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]