define('_side', 'site');
session_start();
define("_rootdir", realpath(dirname(__file__) . "/..") . "/");
require_once(_rootdir . 'xms/components/misc/load.php');
class Control extends WebControl
{
var $configValues;
var $data = array();
var $uriInfo = array();
function __construct() {
$address_id = input::get("address_id");
$xzine_id = input::get("xzine_id");
$xzine2_id = input::get("xzine2_id");
$uiting_id = input::get("uiting_id");
$article_id = input::get("article_id");
$hash = input::get("hash");
$protocol = input::get("protocol");
$link = input::get("link");
// stats in de database zetten
$from = array();
$from["address_id"] = $address_id;
$from["xzine_id"] = $xzine_id ? $xzine_id : $xzine2_id;
$from["xzine_id_in_url"] = $xzine2_id;
$from["uiting_id"] = $uiting_id;
$from["protocol"] = $protocol;
$from["link"] = $link;
$from["source"] = "MAIL";
$from["stat_time"] = strftime("%F %T");
$from["remote_addr"] = input::server("REMOTE_ADDR");
$from["user_agent"] = input::server("HTTP_USER_AGENT");
if($article_id) {
$from["type"] = "VIEW";
$from["article_id"] = $article_id;
} elseif ($protocol) {
$location = $protocol . "://" . $link;
$from["type"] = "LINK";
} else {
//$protocol = "http";
$location = "/" . $link;
$from["type"] = "LINK";
}
databaseControl::doInsert("xzine_stats", $from);
// En dan de url opbouwen
$ignore = array("address_id", "protocol", "link", "type", "PHPSESSID","article_id","xzine2_id", "uiting_id", "phplm_expand","username", "phplm_collapse" );
$extension = "geen idee nog";
if($extension == "pdf") {
} elseif (strstr($location, "?")===false) {
$location.= "?";
} else {
$location.= "&";
}
foreach($_GET as $key => $val) {
if (!in_array($key, $ignore)) {
$ignore[] = $key;
$val = trim($val, "?_");
$location.= "$key=$val&";
}
}
if ($address_id > 0 ) {
$rand = rand(101, 999);
$user = $rand . "" .(strrev($rand) + $address_id);
output::session("srandadd", $user);
$location .= "r=" . $user;
}
$location = trim($location, "?_");
header("location: $location");
exit;
}
}
$objSite = new Control();