Hello,
I'm currently running an application script that involves a function that will create a new thread on my forum. The script seems to run if I put the php file inside the root directory of my forum but if I try to move the file anywhere else on the server, it doesn't work. I'm using require() function with the correct paths pointing to the global.php and includes.
Directory structure of when myfile.php works:
/test/forumstest/myfile.php
(works)
/test/forumstest/application/myfile.php
(doesn't work)
/test/application/myfile.php
(doesn't work)
Heres the code:
Code:
// CREATE THREAD IN PUBLIC RECRUITING
$forumURL = "/var/www/html/test/forumstest"; // no forward slash
require_once($forumURL.'/global.php');
require_once($forumURL.'/includes/class_dm.php');
require_once($forumURL.'/includes/class_dm_threadpost.php');
require_once($forumURL.'/includes/functions_databuild.php');
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
/* vars */
$forumid = 31; // can also be a number ;) $forumdid= 12;
$title = $charNames.' '.$charClass;
$pagetext = $message;
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
/* strip */
$forum_id = (int)$forum_id;
$pagetext = (string)strip_tags($pagetext);
$title = (string)strip_tags($title); //
$threaddm->set('forumid', $foruminfo['forumid']);
$threaddm->set('userid', 3963);
$threaddm->set('title', $title);
$threaddm->set('pagetext', $pagetext);
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->set('dateline', TIMENOW);
$threaddm->pre_save();
if (count($threaddm->errors) > 0) {
print_r($threaddm->errors);
}
else {
$threaddm->save();
build_forum_counters($forum_id);
echo 'Yay!';
}