We seem to have an issue with some users browsers (internet exploder) submitting multiple requests at once. So I added this simple velocity check, do you guys have any suggestions?
I made the resolution in days just to play it safe. Typically these "inspections" are only ordered once every 3-6 years.
/**
* check to make sure that this inspection request is not being spammed
*
* @param type $form
*/
private function velocityCheck($form)
{
return !Inspection::model()->exists('lastName=:lastName AND addressOne=:addressOne AND type=:type AND TO_DAYS(dateAdded) != TO_DAYS(NOW())', array(
':lastName'=>$form->lastName,
':addressOne'=>$form->addressOne,
':zip'=>$form->zip,
':type'=>$form->type));
}