示例#1
0
$p = new Product($db);
$product = $p->getProduct($_GET['product']);
if (!isset($product['id'])) {
    die('Product does not exist!');
}
include "go_template.html";
require 'include/class.user.php';
$u = new User($db);
$user = $u->getUserByEmail($_GET['email']);
if (!isset($user['id'])) {
    $u->Insert(array('name' => 'Unknown user', 'email' => $_GET['email'], 'source' => isset($_GET['source']) ? $_GET['source'] : ''));
    $user = $u->getUserByEmail($_GET['email']);
}
require 'include/class.tracking.php';
$t = new Tracking($db);
$hash = $t->newSession(array('user_id' => $user['id'], 'product_id' => $product['id'], 'source' => 'forwarder', 'cid' => $_GET['cid']));
$link = $product['networkLink'];
if (strlen($product['parameter']) > 0) {
    if (strpos($link, '?') !== false) {
        $link .= "&" . $product['parameter'];
    } else {
        $link .= "?" . $product['parameter'];
    }
}
$link = str_replace(array("{product}", "{transaction_id}", "{email}"), array($product['replacement'], $hash, $_GET['email']), $link);
if ($product['auto_subscribe_enabled'] != '1' || $product['auto_subscribe_lists'] == '0' || $product['auto_subscribe_lists'] == '') {
    ?>
<script type="text/javascript">
	setTimeout( function() {
		location.href = '<?php 
    echo $link;