Fix townblock owner tests to prevent people from other towns setting
plot perms.
Fix SQL prepared statement code (BIG thanks to JamieKG for all his
testing).