I'm not sure I understand. Do you mean make it so that someone can't just enter the url in their browser and run it? The scheduled tasks that come with vbulletin have this at the beginning:
PHP Code:
if (!is_object($vbulletin->db)) { exit; }
so that if it's not included from a script that has already set up $vbulletin, it won't run.
Good to know, Kevin!
What I did for one of my external PHP files (called via clicking a link) is this: