Page 1 of 1

Tidy Code

Posted: Mon Apr 09, 2007 2:56 am
by andym01480
I have learnt some stuff recently about tidy and thus more secure code...

Mainly using arrays for all data to be processed:
All input from $_GET, $_POST etc to be stored in an array eg $input()
Cleaned up (checked it is safe and what I wanted) input in a different array $clean()
Outputed data to browser where no html tags are wanted in another array $html() where htmlentities() has been applied
Outputed data to mysql stored in $mysql() which has been escaped

What other principles for tidier and more secure coding are there?

Posted: Mon Apr 09, 2007 8:20 am
by feyd
Consistency and highly readable code.

Posted: Mon Apr 09, 2007 11:24 am
by RobertGonzalez
Good variable names, clean indenting, great commenting...

Posted: Mon Apr 09, 2007 12:02 pm
by Ollie Saunders
Code by these