summaryrefslogtreecommitdiff
path: root/listdrobpoxes.cgi
blob: 9a28f968988a16511456d37fb6f42483bc74d040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl

use strict;
use CGI;
use File::Basename;
use lib dirname( __FILE__ ) . '/lib';
use rddb;

my $status = 'ERROR';
my $errorstring = 'unknown';
my $responsecode = 500;

my $q = CGI->new;

my $username = $q->param('LOGIN_NAME');
my $token = $q->param('PASSWORD');

my $dbh;
($dbh, $status, $errorstring) = rddb::opendb();
if(defined $dbh) {
  my $result;
  ($result, $status, $errorstring) = rddb::check_token($dbh, $username, $token);
  if($result == 1) {
    $responsecode = 200;
  } elsif($result == 0) {
    $responsecode = 403;
  } else {
    $responsecode = 500;
  }
  rddb::closedb($dbh);
}

print "Content-type: application/xml\n\n";

print "<RDWebResult>\n";
print "  <ResponseCode>" . $responsecode . "</ResponseCode>\n";
print "  <ErrorString>" . $errorstring . "</ErrorString>\n";
print "</RDWebResult>\n";