foreach ($stjernetraef['products'] as $product) {
            // 122 er stjernetræf
            $client->changeBasket($product['id'], 0);
        }
        $client->changeBasket($_POST['stjernetraef'], 1);
    }
    if (empty($error) and count($error) == 0) {
        header('Location: basket.php');
        exit;
    }
}
$basket = $client->getBasket();
$elevmoede = $client->getProducts(array('keywords' => array(121)));
$stjernetraef = $client->getProducts(array('keywords' => array(122)));
$jubilaeum = $client->getProducts(array('keywords' => array(120)));
$tilmelding_tpl = new Template(PATH_TEMPLATE);
$tilmelding_tpl->set('error', $error);
$tilmelding_tpl->set('items', utf8_decoding($basket['items']));
$tilmelding_tpl->set('elevmoede', utf8_decoding($elevmoede['products']));
$tilmelding_tpl->set('stjernetraef', utf8_decoding($stjernetraef['products']));
if (is_jubilar($auth)) {
    $tilmelding_tpl->set('jubilaeum', utf8_decoding($jubilaeum['products']));
} else {
    $tilmelding_tpl->set('jubilaeum', '');
}
$basket = $client->getBasket();
$tilmelding_tpl->set('selected_items', $basket['items']);
$tpl = new Template(PATH_TEMPLATE_KUNDELOGIN);
$tpl->set('title', 'Tilmelding');
$tpl->set('content_main', $tilmelding_tpl->fetch('elevforeningen/tilmelding.tpl.php'));
echo $tpl->fetch('main.tpl.php');
<?php

require 'include_elevforeningen_login.php';
$values = $auth->getContact($_SESSION['contact_id']);
$values = utf8_decoding($values);
$form = new HTML_QuickForm();
$form->addElement('hidden', 'id');
$form->addElement('text', 'name', 'Navn', array('size' => 40));
$form->addElement('text', 'address', 'Adresse', array('size' => 40));
$form->addElement('text', 'postcode', 'Postnr.', array('size' => 4));
$form->addElement('text', 'city', 'Postby', array('size' => 40));
$form->addElement('text', 'email', 'E-mail', array('size' => 40));
$form->addElement('text', 'phone', 'Telefon', array('size' => 8));
$form->addElement('submit', NULL, 'Gem');
$form->setDefaults(array('id' => $values['id'], 'name' => $values['name'], 'address' => $values['address'], 'postcode' => $values['postcode'], 'city' => $values['city'], 'phone' => $values['phone'], 'email' => $values['email']));
if ($form->validate()) {
    if ($auth->saveContact($form->exportValues())) {
        header('Location: index.php');
        exit;
    } else {
        trigger_error('Kunne ikke gemme', E_USER_ERROR);
    }
}
$tpl = new Template(PATH_TEMPLATE_KUNDELOGIN);
$tpl->set('content_main', '
    <h1>Ret oplysninger</h1>
    <p><a href="index.php">Luk uden at gemme</a></p>
    ' . $form->toHTML());
echo $tpl->fetch('main.tpl.php');
<?php

require 'include_elevforeningen_login.php';
$client = new IntrafacePublic_Shop_XMLRPC_Client($credentials, false);
$product = utf8_decoding($client->getProduct($_GET['id']));
$basket = $client->getBasket();
$selected_items = $basket['items'];
$value = '';
if (is_array($selected_items) and count($selected_items) > 0) {
    foreach ($selected_items as $item) {
        if ($product['id'] == $item['product_id']) {
            $value = $item['quantity'];
        }
    }
}
$pic = '';
if (isset($product['pic_id']) and $product['pic_id'] > 0) {
    $pic = '<img src="' . $product['fileviewer'] . '" alt="" style="float: right;" />';
}
$tpl = new Template(PATH_TEMPLATE_KUNDELOGIN);
$tpl->set('title', 'Tilmelding');
$tpl->set('content_main', '
    <h1>' . $product['name'] . '</h1>
    ' . $pic . '
    ' . nl2br($product['description']) . '<br /><br />
    <form action="bestilling.php" method="post">
        <label for="order_id">Antal
            <input type="text" name="order[' . $product['id'] . ']" id="order_id" value="' . $value . '" size="2" />
        </label>
        <input type="submit" value="Bestil" />
    </form>
<?php

require 'include_elevforeningen_login.php';
$contact = $auth->getContact($_SESSION['contact_id']);
$client = new IntrafacePublic_Shop_XMLRPC_Client($credentials, false);
$basket = $client->getBasket();
$items = utf8_decoding($basket['items']);
$amount = $basket['price_total'];
$form = new HTML_QuickForm();
$form->addElement('submit', 'tilmeld', 'Bestil');
if (count($items) > 0) {
    $form_view = '
    <h2>Betaling</h2>
    <dl>
        <dt>Betal med Dankort</dt>
        <dd>Du betaler med <span class="dankort">Dankort</span>. Men først skal du have bestilt noget.</dd>
    </dl>
    ' . $form->toHTML();
} else {
    $form_view = '';
}
if ($form->validate()) {
    $order = array('contact_id' => $contact['id'], 'description' => 'Tilmelding ' . date('Y'));
    //$amount = $client->getBasketPrice();
    $order_id = $client->placeOrder($order);
    // $debtor_client = new DebtorClient(array('private_key' => $private_key), false);
    // $debtor_client->setSent($order_id);
    $_SESSION['order_id'] = $order_id;
    $_SESSION['amount'] = $amount;
    header('Location: betaling.php');
    exit;
    $debtor_tpl->set('caption', 'Accepterede tilmeldinger');
    $debtor_tpl->set('debtors', utf8_decoding($invoices));
    $debtor_tpl->set('credentials', $credentials);
    $string .= $debtor_tpl->fetch('elevforeningen/debtors.tpl.php');
}
if (count($orders) > 0) {
    $debtor_tpl = new Template(PATH_TEMPLATE);
    $debtor_tpl->set('caption', 'Afventende tilmeldinger');
    $debtor_tpl->set('debtors', utf8_decoding($orders));
    $debtor_tpl->set('credentials', $credentials);
    $string .= $debtor_tpl->fetch('elevforeningen/debtors.tpl.php');
}
if (is_jubilar($auth)) {
    $headline .= ' og jubilæum';
}
if (is_array($debtors) and count($debtors) > 0) {
    $debtor_tpl = new Template(PATH_TEMPLATE);
    $debtor_tpl->set('caption', 'Bestillinger og fakturaer');
    $debtor_tpl->set('debtors', $debtors);
    $string .= $debtor_tpl->fetch('elevforeningen/debtors.tpl.php');
}
$contact_tpl = new Template(PATH_TEMPLATE);
$contact_tpl->set('caption', 'Kontakt');
$contact_tpl->set('contact', utf8_decoding($contact_array));
$tpl->set('content_main', '
    <h1>Velkommen</h1>
    ' . $contact_tpl->fetch('elevforeningen/medlem.tpl.php') . '
    <h2>' . $headline . '</h2>
    ' . $string . '
    ');
echo $tpl->fetch('main.tpl.php');