Enabled some debugging, added some SQL safeguards, introduced login page

Enabled some debugging, added some SQL safeguards, introduced login page