main.part.php
Refactors login & adds IP restriction support