How about namspacing? Very usefull in preventing conflicts, but requires PHP 5.3.

if($input == 'true' || $input == 'false')

Not a good idea mate, then when you do a mysql_real_escape_string it will return 1. not 'true'