-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtrackerimage.jpg.php
32 lines (25 loc) · 1.06 KB
/
trackerimage.jpg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// trackerimage.jpg.php
// You are collecting some info about your users
// in this case it's the email campaign they've opened...
$campaignID = intval($_GET['campaignID']);
// and the subscription ID - you saved that from your
// double opt-in registration, right?
$subscriptionID = intval($_GET['subscriptionID']);
// load the Database abstractor
require_once('settings.php');
require_once('classes/EmailTracker.class.php');
// someone accessed this script by opening an email
// and displaying images. Let's store that knowledge
$EmailCampaign = new EmailCampaign($campaignID, $settings['mysql']);
$EmailCampaign.emailOpenedBy($subscriptionID, time());
// load the image
$image = 'images/images.jpg';
// getimagesize will return the mimetype for this image
$imageinfo = getimagesize($image);
$image_mimetype = $imageinfo['mime'];
// tell the browser to expect an image
header('Content-type: '.$image_mimetype);
// send it an image
echo file_get_contents($image);
?>