In reference to your original post DW, I know exactly how you feel. As a newbie to PHP, this is something that I always hear about as well. Alot of the concerns had to do with abuses of form variables/validation and SQL injection. Luckily since the later revisions of PHP 4+, there have been alot of enhancements made to ensure security. This is especially true since PHP is starting to gain some steam as an "enterprise ready" app and wants to be taken seriously by bigger companies. Here are some rules that I have learned that helped me greatly in feeling more secure about my code:
1) Always assume the worst intentions with form submissions. This is the gateway for any cracker to try and break your system so they can get access to your critical data. Assume that every data field will have an SQL injection or use special control characters (use the addslashes function to remedy this.) I find it better to cycle through POST/GET variables, sanitize them and then assign a regular variable name.
2) The most common way to check user authorization in your code is to check the condition of a variable. I usually start the code by unsetting the variable and then setting it once the login/cookie has been validated with a 1 value. Later in the code you can then check to see if the variable isset() and if the value == 1. Pick something unique that you would only reference for authentication (don't make it a common variable like $username, etc...)
3) Always store sensitive data in your database as a salted/hashed string (this goes for passwords or unique identifiers.) Here is a common function I have in my library...
function encryptString($string)
{
static $secret_word = 'mysecretwordwithnonsensephrases';
$salted = crypt($string, "Ba");
$hash = md5($secret_word.$salted);
return $hash;
}
Anytime you need to compare a submitted password for example, you would run encryptString() on the submitted password and then compare the hash against the hash in the database. Salting the has beforehand adds an extra layer of security in case they try to do a brute force attack on a plain text to md5 hash.
Here is another good link on the topic http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
AND ALWAYS REMEMBER, www.php.net IS YOUR FRIEND!!! π