#!/usr/bin/perl
use lib '.';
use strict;
use CGI;
use ADBGUI::Tools qw(ReadConfig);
use ticketserver::DBManager;

my $code = $ARGV[0];

my $q = CGI->new;
print "Content-type: text/html\r\n\r\n"
   if ($ENV{'SERVER_PROTOCOL'});

$code ||= $q->param('code');
$code =~ s/[^0-9a-zA-Z]//g;

unless ($code) {
   print "You need to pass the code= as parameter!\n";
   exit(0);
}

my $config = ReadConfig('dbm.cfg');

if (my $code = ticketserver::DBManager::getVerifiedNumConfig($config, uc($code))) {
   print "Code is ".$code."\n";
} else {
   print "Bad code ".$code."!\n";
}

