]> ruin.nu Git - ndwebbie.git/blobdiff - index.pl
adding points
[ndwebbie.git] / index.pl
index bfb7a738813a39aec091cf9e114954606d86e70c..03f62f1b9779a956b2abb739c2b12a230e882743 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -51,6 +51,7 @@ for my $file ("db.pl","include.pl"){
 
 ($TICK) = $DBH->selectrow_array('SELECT tick()',undef);
 
+
 my $query = $DBH->prepare('SELECT groupname,attack,gid from groupmembers NATURAL JOIN groups WHERE uid = ?');
 $query->execute($UID);
 
@@ -61,20 +62,15 @@ while (my ($name,$attack,$gid) = $query->fetchrow()){
        $ATTACKER = 1 if $attack;
 }
 
-$TEMPLATE->param(Tick => $TICK);
-$TEMPLATE->param(isMember => isMember());
-$TEMPLATE->param(isHC => isHC());
-$TEMPLATE->param(isDC => isDC());
-$TEMPLATE->param(isBC => isBC());
-$TEMPLATE->param(isAttacker => $ATTACKER);
-
 
+our $LOG = $DBH->prepare('INSERT INTO log (uid,text) VALUES(?,?)');
 
 my $page = 'main';
-if (param('page') =~ /^(main)$/){
+if (param('page') =~ /^(main|check|motd|points)$/){
        $page = $1;
 }
 
+print header;
 $ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl");
 
 unless (my $return = do "${page}.pl"){
@@ -83,7 +79,15 @@ unless (my $return = do "${page}.pl"){
        print "<p><b>couldn't run $page</b></p>"       unless $return;
 }
 
-print header;
+my $fleetupdate = $DBH->selectrow_array('SELECT landing_tick FROM fleets WHERE uid = ? AND fleet = 0',undef,$UID);
+
+$TEMPLATE->param(Tick => $TICK);
+$TEMPLATE->param(isMember => (($TICK - $fleetupdate < 24) || isScanner()) && $PLANET && isMember());
+$TEMPLATE->param(isHC => isHC());
+$TEMPLATE->param(isDC => isDC());
+$TEMPLATE->param(isBC => isBC());
+$TEMPLATE->param(isAttacker => $ATTACKER && (!isMember() || ((($TICK - $fleetupdate < 24) || isScanner()) && $PLANET)));
+
 $ND::TEMPLATE->param(BODY => $ND::BODY->output);
 print $TEMPLATE->output;