Skip to content

Tag: security

How to ban all executable files on Apache

I would like to find out the most effective way to ban any executable files from one specific sub folder on my server. I allow file uploads by users into that folder, and would like to make that folder accessible from the web. I have the root folder pretty much locked down with mod_rewrite. In that one unprot…

PHP input sanitizer function?

What’s a method to sanitize PHP POST data for passing to a mail function? (I prefer a method that’s not part of the mysql_function() family of functions.) I take the data, sanitize it, print it back to the user and send it in an email to a preset address. EDIT: I’m just sending the email to …

How can I encrypt a cookie value?

How can I encrypt, and later decrypt, a cookie value in PHP? How secure will the encryption be? Answer I can not simply think of a situation where encrypting data in the cookie is useful. If you want to retain secret data about the user or his preferences, information, whatever, then store it on the server in…

PHP: filter_var sanitization secure enough?

I have a PHP script with the following line: Is this safe enough? How would you improve this code? Answer It is safe for that case, but for a more general approach, I’d rather use mysql_real_escape_string in conjunction with type casting: In the worst case, that will result in a 0 and will escape all ma…