setVar("ERRORS", ""); $t->setVar("ID", ""); $t->parse(); } ############################# function search() { ############################# $_POST['id'] = str_replace("/", "", $_POST['id']); $_POST['id'] = str_replace("-", "", $_POST['id']); $query = sprintf("SELECT * FROM bruckmuehle_ticketculturecard WHERE id = %d LIMIT 1", sqlnum($_POST['id'])); $result = dbQuery($query); if ($line = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $t = new Template("templates/update.html"); $t->setVar("ID", $line['id']); $t->setVar("OWNER", htmlentities($line['owner'])); $t->setVar("ADDRESS", htmlentities($line['address'])); $t->setVar("ZIP", $line['zip']); $t->setVar("CITY", $line['city']); $t->setVar("SPA_ENTRIES", $line['spaEntries']); $str = sprintf("%012d", $line['id']); $id = substr($str, 0, 5) . "/" . substr($str, 5, 2) . "/" . substr($str, 7, 2) . "/" . substr($str, 9, 3); $t->setVar("FORMAT_ID", $id); $opt = ''; for ($i = 1; $i <= $line['spaEntries']; $i++) { $opt .= ''; } $t->setVar("COUNT", $opt); $t->parse(); } else { $t = new Template("templates/search.html"); $t->setVar("ERRORS", "Die Suche ergab keinen Treffer!"); $t->setVar("ID", $_POST['id']); $t->parse(); } } ############################ function update() { ############################ $query = sprintf("UPDATE bruckmuehle_ticketculturecard SET spaEntries = (spaEntries - %d) WHERE id = %d", sqlnum($_POST['count']), sqlnum($_POST['id'])); dbQuery($query); $t = new Template("templates/done.html"); $t->setVar("COUNT", $_POST['count']); $str = sprintf("%012d", $_POST['id']); $id = substr($str, 0, 5) . "/" . substr($str, 5, 2) . "/" . substr($str, 7, 2) . "/" . substr($str, 9, 3); $t->setVar("FORMAT_ID", $id); $t->parse(); } ?>