Log in

View Full Version : New thread from outside vb3.


XSIer
07-20-2004, 12:54 PM
hi,
How can i create new thread from a php script.

is there a known query or i can do it by using afunction from global.php ?

thanks.

all-the-vb
07-21-2004, 03:36 AM
<?php
chdir("/path/to/forums/");
require_once('./global.php');

// here your code
?>


edit:

chdir("/path/to/forums/");


to your forum patch.

Andreas
07-21-2004, 07:14 AM
In the above code, replace // here your code with


$forumid = 46; // Replace this with your forum id
$foruminfo = fetch_foruminfo($forumid, false);
// Prepare Post
$post[title] = 'New thread title';
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[message] = 'New thread post content';
require_once('./includes/functions_newpost.php');
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);


Btw: This is a FAQ. You will find this or very similar code snippets in many threads already.