a quick and simple fix, yes?
# in post_stuff()
# after "# proxy check"
$dbh->do("LOCK TABLES ".SQL_TABLE." WRITE");
# before "# set the name, email and password cookies"
$dbh->do("UNLOCK TABLES");
N.B. the implications of this code: all posts are serialized, which means some requests will take a very long time to execute, tying up a mysql connection slot all the while.