Photoionization and photodissociation in diffuse interstellar clouds