emailtracking/php/track.php

32 lines
883 B
PHP
Executable File

<?php
require __DIR__ . "/lib/class.EmailTracker.php";
$trackingID = "";
$type = "none";
// check which type was logged
if(isset($_GET["img"])) {
$trackingID = $_GET["img"];
$type = "img";
} else if(isset($_GET["sound"])) {
$trackingID = $_GET["bgsound"];
$type = "bgsound";
}
if(!empty($trackingID) && $type !== "none") {
$dbObj = new EmailTracker();
// build our tracking entry
$data = array(
"ip_addr" => $_SERVER["REMOTE_ADDR"],
"referrer" => isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "",
"client" => isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "",
"tracking_type" => $type,
"timestamp" => date('Y-m-d H:i:s', time()),
);
// log it to db
$dbObj->addLog($trackingID, $data);
} else {
echo "Powerful you have become, the dark side I sense in you.";
}