hmm... maybe global.php won't let you use it outside of a browser... try this instead.
PHP Code:
<?php
$db = mysql_connect($db_server, $db_user, $db_pass) or
die("Could not connect to database with error (".mysql_error().")");
$db_sel = mysql_select_db($db_name, $db) or
die("Could not select database $db_name with error (".mysql_error().")");
mysql_query("UPDATE thread SET open = 0 WHERE dateline < ".(TIMENOW - (60 * 60 * 24 * 364))." AND forumid IN (3,4,5)", $db);
?>
(replacing the necessary variables with your database info of course

)