This is the basic form I use for my cron jobs:
PHP Code:
<?php
// ########### SET PHP ENVIRONMENT ##################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
all your php goes here. Use standard vbulletin calls for your queries. ie:
$mysquery = $vbulletin->db->query_read("
SELECT this, that
FROM " . TABLE_PREFIX . "table
WHERE whatever
");
?>