
If you need to create custom pages that use $_SESSION or even access the database via your standard PHP MySQL calls, you can ‘piggyback’ your Drupal site using the $title variable in the page.tpl.php page…
I’ve used this technique many times to do everything from adding a page called by AJAX, to whole password protected member areas with it’s own set of database tables…
In it’s simplest form, first add a node so Drupal has something we can catch, (in English, create a page titled ‘Test’… Note I’ve used a capital ‘T’).
Next open page.tpl.php and locate ‘print $content’. Basically we replace with:
if ($title=='Test'){ include 'filepath/filename.php'; } else { print $content; }
Save, upload, create your include file and upload to ‘filepath/filename.php’… When you visit the page ‘Test’ you created in Drupal, the header, footer, sidebars, etc are all loaded as normal, however whatever would have normally appeared in the ‘content’ area, has now been replaced by the output from your included PHP file…
Now you can use $_SESSION, $_GET, $_POST and standard PHP MySQL commands piggybacking the powerful normal Drupal site.