summaryrefslogtreecommitdiff
path: root/track.php
blob: 2155d7b340fe8f670b55fd225c02f68dcebde747 (plain)
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
33
34
35
36
37
38
39
<?php
/**
 * Copyright (c) 2005 bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * created 2005/12/10
 *
 * @package newsletters
 * @author spider <spider@steelsun.com>
 */

/** 
 * Initialization
 */
require_once( '../kernel/includes/setup_inc.php' );
include_once( NEWSLETTERS_PKG_CLASS_PATH.'BitNewsletterMailer.php' );

if( isset( $_REQUEST["sub"] ) || $gBitUser->isRegistered() ) {
	if( isset( $_REQUEST["sub"] ) && strlen( $_REQUEST["sub"] ) == 32 && ($subInfo = BitNewsletterMailer::lookupSubscription( array( 'url_code' => $_REQUEST["sub"] ) )) ) {
		BitNewsletterMailer::trackMail( $subInfo['url_code'] );
	}
}

// open the file in a binary mode
$trackImage = $gBitSystem->getConfig( 'newsletter_tracking_image', NEWSLETTERS_PKG_PATH.'images/track.gif' );

if( $fp = fopen( $trackImage, 'rb') ) {
	// send the right headers
	header( "Content-Type: image/png" );
	header( "Content-Length: " . filesize( $trackImage ) );

	// dump the picture and stop the script
	fpassthru( $fp );
}

exit;

?>