Cause is completely integrated into our Forum-Game-Main Page system, we use external C++ Applications to automate some managament at server so this work was really hard to separate one piece and share it.
Anyway I can give you some explanations about some good PHP coding practices, like use Objects to store RQUEST variables and prevent any type of SQL Injection.
www.php.net/manual/en <--------- Your best friend.