if ($parse_stats == 1) {
my $pasted = $cgi->param('pasted');
if ($pasted eq "") {
print '
dumm geklickt, was?
';
} else {
# $sth = $dbh->prepare("delete from allystats where date=curdate();");
# $sth->execute;
my ($place, $ally, $members, $points, $valid) = (0, "", 0, 0, 0);
my @todo = ();
my ($start, $end) = (99999, 0);
foreach (split(/\n/, $pasted)) {
# 1 * T.u.C 17 43842 2578
next unless (/^\s*\d+/);
my @arr = split(/\s+/, $_);
if ($#arr >= 5) {
if ($arr[0] > 0) {
$place = shift @arr;
$start = $place if ($place < $start);
$end = $place if ($place > $end);
shift @arr; pop @arr;
$points = pop @arr;
$members = pop @arr;
$ally = join(" ", @arr);
push(@todo, "insert into $uni{'name'}_allystats set ally='$ally', members='$members', points='$points', date=curdate(), place='$place';");
$valid++;
}
} else {
#print "Fehler beim parsen der Zeile: ".join(" ", @arr)."
\n" if (@arr != ());
}
}
$sth = $dbh->prepare("delete from $uni{'name'}_allystats where place>=? and place<=? and date=curdate();");
$sth->execute($start, $end);
$sth = $dbh->do($_) foreach (@todo);
$template->param(TMP => "Es konnten $valid Zeilen benutzt werden (Plätze $start - $end).");
}
}