Disable client Cookie from Serverside

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
windforceus
Forum Newbie
Posts: 23
Joined: Tue Mar 15, 2005 12:40 pm

Disable client Cookie from Serverside

Post by windforceus »

Hi everyone

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++;
}

?>
here is my php page which record the information to database:

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;
	}
Jcart | Please use

Code: Select all

tags when posting code.   [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

for starts please use the PHP coder for the Forum and second of all check http://www.php.net for some help for the cookie problem


Smackie
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You cannot "disable" their cookie functions, but you can delete your own cookies you have set (in other words expire).

Code: Select all

setcookie('cookie',time()-3600);
This will expire $_COOKIE['cookie']
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

be aware that a lot of email clients are turning off or have turned off immediate level support for images. Unless they are inline to the email, most clients will only show the images if the user tells it to.
windforceus
Forum Newbie
Posts: 23
Joined: Tue Mar 15, 2005 12:40 pm

Regard the cookie reply

Post by windforceus »

I know I can disable my cookie. My problem is when clients use outlook to receive my html email. I need to do something to make outlook load my image every time clients open it.Someone plz give me some idea. I am stuck.
Post Reply