Custom Page type and variables
Assuming you put the preprocess code in your theme's template.php, coding this inside a node ought to work  - but in order for it to do so you have to 


make sure the Core "PHP Filter" module is enabled and  
make sure the node's Input Format is set to "PHP code."


As I noted, this is not the most secure or maintainable way to do things, but it'll let you do what you want without messing about in page or node templates.