Understanding and Preventing SQL Injection Attacks