<?php
if (!class_exists('crm_users')) require_once("common_cadline_libraries/crm_users.class.php");
if (!class_exists('crm_hardlock')) require_once("common_cadline_libraries/crm_hardlock.class.php");

$encoded = $_GET['id'];
$decoded = base64_decode($encoded);

$email = crm_hardlock::get_valueFromStringUrl($decoded, 'email');
$alias = crm_hardlock::get_valueFromStringUrl($decoded, 'alias');

$query = "SELECT * FROM " . JMLADATBAZIS . ".followed_links WHERE alias = ? LIMIT 1";
Database::getInstance()->query($query, array('s', $alias));
$res = Database::getInstance()->fetchNext();

crm_users::levelesemeny($email, "events", "newclick", $res['esem_id'], $res['esem_cont'], $res['name']);

header('Location: ' . $res['redirect']);
exit();
