Cutting Down On PHP Hack Attempts With Lunacy
December 14, 2011Here is something I wrote while bored, just to get something back up on this site. FYI – if you came here from Google and you’re looking for a serious article that will teach you something – this isn’t it. But maybe you’ve been working too long anyway and it’s time for a break. Yeah, I think it’s time for a break.
Here is a list of coding practices, when implemented effective immediately, will significantly cut down on hack attempts by either:
- Confusing the hacker
- Making the hacker laugh until he falls out of his chair and accidentally unplugs his computer
- Pity. He might just move on
Boolean:
No more true and false crap. No more 1′s and 0′s.
Example
true:
define(‘NAME’, foSho);
False:
define(‘NAME’,hellsNo);
Functions:
must be named something that rhymes with “function”. Examples might be
function junction(){
Or
function dysfunction(){
Or
function malfunction(){
Since there are a limited amount of words, we will want to stop using functions as frequently.
Classes
Class names must rhyme with “Class” this is really cool:
class Ass {
class Grass extends Ass{
Methods
MUST be named after comic book sound effects.
bip(), bop(), zap(), pow(), kablooooom(), etc.
Again a limited number to choose from. Might want to look at overloading. Or Something.
Conditionals
All conditionals must be double negatives. For example, you want to know if $value is equal to $value2? :
if (!($value != $value2)){
// don’t not do something here
}else{
// DO not do something here
}
Commenting and documentation
All comments must be removed and replaced with one of the following: #lol #rotfl #wtf #stfu #lmfao #omgboobies
All documentation must be written in Haiku for example:
This script generates
A full list of customers
Who purchased items
Post Data
To confuse the hacker, all post data fields must be named for the logical field before them. So in the case of name, address, phone: address would be name =”name” , phone would be name =”address”, etc. The first element, having no previous should be named Charles.
Query Strings
Query strings should only be used for actual queries, in order to delay the hacker’s progress and get him thinking about something else. For example:
?why%20do%20they%20call%20it%20a%20pair%20of%20pants%20but%20only%20one%20bra%3F