# htaccess will rewrite this to be emailtracking.php?u=1&e=2 /* $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Holiday Discount Centre '. "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); mail("danord24@gmail.com","Test","Test Email ",$headers);*/ require_once("includes.php"); // Connect to DB # Set up variables $userid = $database5->filter($_GET['u']); $emailid = $database5->filter($_GET['e']); $date = date('U'); $ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"]); # Check if this user has already viewed this email, if so, don't bother recording it. if(is_numeric($userid) && is_numeric($emailid)) { $result = $database5->get_results("SELECT * FROM hdc_new_emailtracking WHERE userid = '$userid' AND emailid='$emailid'"); // Has user viewed this email? if(count($result) == 0) // If not... { $database5->insert('hdc_new_emailtracking',array('userid'=>$userid,'emailid'=>$emailid,'date'=>$date,'ip'=>$ip)); // Record the view } } # Now we output the spacer image the email is actually requesting in the first place. $file = 'images/spacer.gif'; $type = 'image/gif'; header('Content-Type:'.$type); header('Content-Length: ' . filesize($file)); readfile($file); ?>