chdir $ENV{'DOCUMENT_ROOT'};
our $DBH = undef;
-our $UID = undef;
-our $PLANET = undef;
-our $TEMPLATE = undef;
-our $TICK = undef;
+our $USER = $ENV{'REMOTE_USER'};
-$ND::TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl');
+our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl');
for my $file ("db.pl","include.pl"){
unless (my $return = do $file){
}
}
-($UID,$PLANET) = $DBH->selectrow_array('SELECT uid,planet FROM users WHERE username = ?'
+our ($UID,$PLANET) = $DBH->selectrow_array('SELECT uid,planet FROM users WHERE username = ?'
,undef,$ENV{'REMOTE_USER'});
-($TICK) = $DBH->selectrow_array('SELECT tick()',undef);
+our ($TICK) = $DBH->selectrow_array('SELECT tick()',undef);
my $query = $DBH->prepare('SELECT groupname,attack,gid from groupmembers NATURAL JOIN groups WHERE uid = ?');
our $XML = 0;
$XML = 1 if param('xml') and $page =~ /^(raids)$/;
+my $type = 'text/html';
if ($XML){
- print header(-type=>'text/xml');
+ $type = 'text/xml';
$ND::TEMPLATE = HTML::Template->new(filename => "templates/xml.tmpl");
$ND::BODY = HTML::Template->new(filename => "templates/${page}.xml.tmpl");
}else{
- print header;
$ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl");
}
}
$ND::TEMPLATE->param(BODY => $ND::BODY->output);
-print $TEMPLATE->output;
+my $output = $TEMPLATE->output;
+print header(-type=> $type, -charset => 'utf-8', -Content_Length => length $output);
+print $output;
$DBH->disconnect;
$DBH = undef;
$UID = undef;
+$USER = undef;
$PLANET = undef;
$TEMPLATE = undef;
$TICK = undef;