X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=editRaid.pl;h=1d5e1375c6b39971221c7204996a341bb466c735;hb=6c20d304218fc636a83b882fb5a47bac41ea5fb2;hp=a1de374e59b81b597583d536b882b07c81b035fc;hpb=49477962790fe1b056d500783d36b6bcb5dd0707;p=ndwebbie.git diff --git a/editRaid.pl b/editRaid.pl index a1de374..1d5e137 100644 --- a/editRaid.pl +++ b/editRaid.pl @@ -19,8 +19,6 @@ use strict; use warnings FATAL => 'all'; -no warnings qw(uninitialized); -use POSIX; our $BODY; our $DBH; our $LOG; @@ -38,7 +36,7 @@ if (param('raid') =~ /^(\d+)$/){ my $query = $DBH->prepare(q{SELECT id,tick,waves,message,released_coords,open FROM raids WHERE id = ?}); $raid = $DBH->selectrow_hashref($query,undef,$1); } -if (param('cmd') eq 'submit'){ +if (defined param('cmd') && param('cmd') eq 'submit'){ my $query = $DBH->prepare(q{INSERT INTO raids (tick,waves,message) VALUES(?,?,'')}); if ($query->execute(param('tick'),param('waves'))){ $raid = $DBH->last_insert_id(undef,undef,undef,undef,"raids_id_seq"); @@ -49,7 +47,7 @@ if (param('cmd') eq 'submit'){ } } -if ($raid){ +if ($raid && defined param('cmd')){ if (param('cmd') eq 'remove'){ $DBH->do(q{UPDATE raids SET open = FALSE, removed = TRUE WHERE id = ?},undef,$raid->{id}); }elsif (param('cmd') eq 'Open'){ @@ -129,12 +127,12 @@ if ($raid){ $error .= "
Something went wrong: ".$DBH->errstr."
"; } } - if (param('removeTarget')){ - $error .= "test"; - unless($DBH->do(q{DELETE FROM raid_targets WHERE raid = ? AND id = ?} - ,undef,$raid->{id},param('removeTarget'))){ - $error .= "Something went wrong: ".$DBH->errstr."
"; - } +} +if ($raid && param('removeTarget')){ + $error .= "test"; + unless($DBH->do(q{DELETE FROM raid_targets WHERE raid = ? AND id = ?} + ,undef,$raid->{id},param('removeTarget'))){ + $error .= "Something went wrong: ".$DBH->errstr."
"; } } @@ -174,7 +172,7 @@ if ($raid){ $BODY->param(Message => $raid->{message}); my $order = "p.x,p.y,p.z"; - if (param('order') =~ /^(score|size|value|xp|race)$/){ + if (param('order') && param('order') =~ /^(score|size|value|xp|race)$/){ $order = "$1 DESC"; }