Added get_valid_ip() function

get_valid_ip() function looks through the list of entries in
last_access_ip and returns a valid ip address if it exists.