PHP is probably the most common language now for Web development. Certainly PHP is a terrific language for the rapid development of dynamic Websites. It also has many features that are friendly to beginning programmers, such as the fact that it doesn't require variable declarations. However, many of these features can lead a programmer inadvertently to allow security holes to creep into a Web application. The popular security mailing lists teem with notes of flaws identified in PHP applications, however PHP can be as secure as any other language once you understand the basic types of flaws PHP applications tend to exhibit. "Security is a process, not a product, and adopting a sound approach to security during the process of application development will allow you to produce tighter, more robust code." Let's list the top 10 PHP Security Flaws here.
if you're talking about mistakes of php coders I would put Forms validation as a major security flaw From there troubles can start
I see alot of people don't know how to access key arrays. $array['key'] NOT $array[key] To access it in a string, you need curly braces. $string = "This string has {$array['key']} value";
Not escaping user input before using it in an SQL query is the biggest one. The only other one I can think of would be people thinking that hashing something twice i.e. (sha1(md5('plaintext'))) makes the hash more secure, when it actually makes it less secure.
I wouldn't say get_magic_quotes_XXX is a security issue, it just tells you whether the horrible magic quotes feature is turned on. Magic quotes is more of an annoyance than a security issue, I think. Though it can create a false sense of security in the unfortunate event that it is turned on.
Access Control Flaws Another type of flaw that's not necessarily restricted to PHP applications, but is important nonetheless, is the access control type of vulnerability.
Session ID Protection Session ID hijacking can be a problem with PHP Websites. The PHP session tracking component uses a unique ID for each user's session, but if this ID is known to another user, that person can hijack the user's session and see information that should be confidential. Session ID hijacking cannot completely be prevented; you should know the risks so you can mitigate them.
If you sanitize all possible user entries ($_POST, $_GET, $_FILES, $_SERVER, etc.), declare and make sure that any additional data is inserted, keep in touch with the latest updates from php.net, check the right permissions, use salt encryption, you 'll make a possible attacker get more trouble getting into your website.