using two HC-SR04 ultrasonic sensors for entry and exit monitoring for an automatic gate.

my project is using two ultrasonic sensors which are driving one stepper motor...my code is successfuly opening the gate when both the entry and exit ultrasound sensors are activated Individually,the challenge is when both the sensors are activated Simultaneously...what do i need to do to the code such that when there's an object detected both at the entry and exit preference is given to the exit....help.

what do i need to do to the code

What code?

(Don't forget the code tags)