cui sql fixes

The default cui module now uses sqlite module.  The post-auth queries don't work because sqlite doesn't allow 'INSERT IGNORE' or 'INSERT ON DUPLICATE' therefore the sqlite queries have been replaced with 'INSERT OR REPLACE' and INSERT for mysql