// [...] $currentDirectory = getcwd(); chdir('/home/path/to/your/vb/forum/'); // Statements for vBulletin insert // [...] // Statements for vBulletin insert chdir($currentDirectory); unset($currentDirectory); // [...]