irc.php: reconnect to database after IRC reconnect (#1024)
irc.php: reconnect to database after IRC reconnect (#1024)

Since we are calling `$db->close()` at the end of each polling cycle,
we need to reconnect to the database before making any queries (by
calling `MySqlDatabase::getNewInstance`).

The simplest way to do this is to move the `irc_seen` cleanup to the
beginning of the reconnect loop, since we probably want to reset the
`irc_seen` stats at that point anyway (as we may have disconnected).

Also simplified the logical layout of the reconnect loop (without
changing functionality).
smrealms/smr,smrealms/smr,hemberger/smr,hemberger/smr,hemberger/smr,hemberger/smr,smrealms/smr