print CGI <<'EOF' if $usedb; sub store_to_db { my ($username, $score) = @_; my $dburl = "*withheld*"; my $dbname = "*withheld*"; my $dbtable = "*withheld*"; my $dbuser = "*withheld*"; my $dbpass = "*withheld*"; print $q->p("Invalid username or score below 20") if $username eq 'Anonymous' or $username eq '' or $score < 20; my $dbh = DBI->connect("DBI:mysql:$dbname:$dburl", "$dbuser", "$dbpass") or print $q->p("Could not connect"); my $sth = $dbh->prepare("INSERT INTO $dbtable (Username, Score) VALUES (?,?)") or print $q->p("Could not prepare"); $sth->execute($username, $score) or print $q->p("Could not execute"); $sth->finish(); $dbh->disconnect; return 1; } EOF