<?php include('../include/functions.php');

$userid = dbEscapeString($_REQUEST['userId']);
$datumerwerb = dbEscapeString($_REQUEST['datumerwerb']);
$subCategories = getSubcategories();

if ($datumerwerb != '') {
    list($day,$month,$year) = explode('.',$datumerwerb);
    $datumerwerb = "$year-$month-$day";
}

/*
$userid = 9663;
$datumerwerb='2011-12-12';
*/

$konto = new konto($userid);
$first = true;
    foreach ($subCategories as $subcategory) {
        if ( $konto->bonuslimit($subcategory->id,$datumerwerb) )
        {
            if (!$first) {
                print ",";
            } else {
                $first = false;
            }
            print $subcategory->id;
        }
    }
