Validating Sql connect, initiating key generation page and organizing some codes.