DC Motor + PIR Sensor

I'll be honest the code i've gotten too muddled with.

Currently it does nothing but what i want it to do is when the sensor detects motion , i want the motor to stop then to start again when the sensor detects no motion.

James