Error handling, order hunts
Added stored procedures for visit validation and database.php function for validating visits

Visits is probably not the neatest of implementations but it works, I
think.