This section will talk about various common vulnerabilites found in PHP sites, and solutions on how to prevent them.
If you are interested in the security of well known PHP applications, there are many resources that you should check on a regular basis. When ever an exploit is found with any program, it gets reported and posted on various security websites, often with solutions on how to fix it.
Here is a good resource for looking up known exploits in widely used PHP applications: SecurityFocus
Most vulnerabilities in PHP code are cause by insufficent input validation procedures (checking the user input). Best practice is to think about what each variable is expected to have and make sure it fits those requirements.
Now to cover some common 'mistakes' people make when coding in PHP and using MySql: