#!/usr/bin/perl

# Display a line indicating the number of registered players.
# Bruno Wolff III
# Last revised October 31, 2012

use Pg;

print "content-type: text/html; charset=UTF-8\n\n";

# First try to connect
$conn = Pg::connectdb('dbname=area');
if ($conn->status != PGRES_CONNECTION_OK) {
  print "unknown \n";
  exit;
}

# Don't need to serialize since only one query is done here.

$result = $conn->exec("select count(1) from cname_web");
if ($result->resultStatus != PGRES_TUPLES_OK) {
  print "unknown \n";
  exit;
}
if ($result->ntuples < 1) {
  print "unknown \n";
  exit;
}
@row = $result->fetchrow;
$reg = $row[0];
print "$reg \n";
