MyBB Community Forums

Full Version: A MyBB Auto Post Bot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to create a bot that automatically posts something on a weekly basis and then any other time I need it to, and have it show up just as if it was an actual user. I will code it and do everything myself, I just need help getting started. Like what would I need to do?

Also, this is for my forum. I would never spam another persons forum.
Learn how to use hooks would be a start, look at the docs in mybb for help their
I understand how to use the hooks.
I mean the mybb system. i would try a smaller one if this is your first mybb plugin. if not... i'd start with another plugin from say vb or phpbb, see how it works.
You cold use a task, and have it insert a certain message into the database every hour/day etc.
Okay, I have it posting (not by itself though...), but it's giving me a strange SQL error that I can't make heads or tails of. Could I get some help? If you need to see the source, just ask:

Error:
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dat' at line 5
Query:
    SELECT COUNT(t.tid) AS unread_count FROM mybb_threads t LEFT JOIN mybb_threadsread tr ON (tr.tid=t.tid AND tr.uid='1') LEFT JOIN mybb_forumsread fr ON (fr.fid=t.fid AND fr.uid='1') WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND t.fid IN () AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dateline,1247081887) AND t.lastpost>1247081887
You should post the SQL query you're trying to run
(2009-07-15, 07:56 PM)Nicholas_Roge Wrote: [ -> ]Okay, I have it posting (not by itself though...), but it's giving me a strange SQL error that I can't make heads or tails of. Could I get some help? If you need to see the source, just ask:

Error:
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dat' at line 5
Query:
    SELECT COUNT(t.tid) AS unread_count FROM mybb_threads t LEFT JOIN mybb_threadsread tr ON (tr.tid=t.tid AND tr.uid='1') LEFT JOIN mybb_forumsread fr ON (fr.fid=t.fid AND fr.uid='1') WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND t.fid IN () AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dateline,1247081887) AND t.lastpost>1247081887

It is because of this "AND t.fid IN ()". You don't have anything in the parenthesis.
(2009-07-15, 08:14 PM)Pirata Nervo Wrote: [ -> ]You should post the SQL query you're trying to run

(2009-07-15, 10:45 PM)skywalker2208 Wrote: [ -> ]
(2009-07-15, 07:56 PM)Nicholas_Roge Wrote: [ -> ]Okay, I have it posting (not by itself though...), but it's giving me a strange SQL error that I can't make heads or tails of. Could I get some help? If you need to see the source, just ask:

Error:
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dat' at line 5
Query:
    SELECT COUNT(t.tid) AS unread_count FROM mybb_threads t LEFT JOIN mybb_threadsread tr ON (tr.tid=t.tid AND tr.uid='1') LEFT JOIN mybb_forumsread fr ON (fr.fid=t.fid AND fr.uid='1') WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND t.fid IN () AND t.lastpost > IFNULL(tr.dateline,1247081887) AND t.lastpost > IFNULL(fr.dateline,1247081887) AND t.lastpost>1247081887

It is because of this "AND t.fid IN ()". You don't have anything in the parenthesis.

Well, I don't even know where this query is located. It's not in my code, and it doesn't give a location except for at line 5. Here's my code which is run from the admin cp:

<?php
 
require_once MYBB_ROOT."/inc/functions_task.php";
 
if(!defined("IN_MYBB"))
{
	die("This file cannot be opened directly.  Please access it through your admin control panel.");
}

$page->add_breadcrumb_item("Forum Bot", "index.php?module=forum/bot");

$currentBot = $db->query("SELECT uid,username FROM mybb_users WHERE isBot=1");

if(!$mybb->input['action'] || $mybb->input['action']=="selectBot")
{
	$sub_tabs['mainMenu'] = array(
		'title' => "Main Menu",
		'link' => "index.php?module=forum/bot",
		'description' => "Teh main menu"
	);
	$sub_tabs['selectBot'] = array(
		'title' => "Select Bot",
		'link' => "index.php?module=forum/bot&amp;action=selectBot",
		'description' => "Select a user to use as a bot.  Please note that the user MUST be in the bot usergroup to be accessible as a bot."
	);
	$sub_tabs['scheduleTask'] = array(
		'title' => "Schedule a Post",
		'link' => "index.php?module=forum/bot&amp;action=postSchedule",
		'description' => "Schedule or batch schedule posts for the bot to post in the future.  HTML, Javascript, PHP is allowed."
	);
}

if($mybb->input['action'] == "postSchedule"){
	
}

if($mybb->input['action'] == "selectBot")
{
	$page->output_header("Select a bot");
	$page->output_nav_tabs($sub_tabs, 'selectBot');
	
	$query = $db->query("SELECT username,uid FROM mybb_users WHERE usergroup=14");
	
	$form_container = new FormContainer("Select a user to set as bot.");
	$form_container->output_row_header("User");
	$form_container->output_row_header("Choose as bot?", array("class" => "align_center", 'width' => '100px'));
	
	while($array = $db->fetch_array($query))
	{
		
		$form_container->output_cell($array['username'], array("class" => "align_left"));

		$form_container->output_cell("<a href=\"index.php?module=forum/bot&amp;botChosen=".$array['uid']."\">USE</a>", array("class" => "align_center"));
		$form_container->construct_row();
	}
	
	if($form_container->num_rows() == 0)
	{
		$form_container->output_cell("There are no users in the bot usergroup.  Sorry!", array('colspan' => 2));
		$form_container->construct_row();
	}
	
	$form_container->end();
	
	//$buttons = array();
	//$buttons[] = $form->generate_submit_button($lang->update_groups_order);
	//$form->output_submit_wrapper($buttons);
	
	//$form->end();
	
	/*echo "<br />
	<fieldset>
<legend>{$lang->legend}</legend>
<img src="styles/default/images/icons/custom.gif" alt="{$lang->custom_user_group}" style="vertical-align: middle;" /> {$lang->custom_user_group}<br />
<img src="styles/default/images/icons/default.gif" alt="{$lang->default_user_group}" style="vertical-align: middle;" /> {$lang->default_user_group}
</fieldset>";*/
	
	$page->output_footer();
}
if($mybb->input['botChosen']){
	$db->query("UPDATE mybb_users SET isBot=0");
	$db->query("UPDATE mybb_users SET isBot=1 WHERE uid=".$mybb->input['botChosen']);
	
	flash_message("User succesfully chosen as bot!", "success");
	admin_redirect("index.php?module=forum/bot");
}

if($mybb->input['action'] == "do_newthread" && $mybb->request_method == "post")
{
	// Verify incoming POST request
	verify_post_check($mybb->input['my_post_key']);

		$username = $currentBot['username'];
		$uid = 173;//$currentBot['uid'];
		$moveto = intval($mybb->input['moveto']);
	
	// Attempt to see if this post is a duplicate or not
	if($uid > 0)
	{
		$user_check = "p.uid='{$uid}'";
	}
	else
	{
		$user_check = "p.ipaddress='".$db->escape_string($session->ipaddress)."'";
	}
	if(!$mybb->input['savedraft'] && !$pid)
	{
		$query = $db->simple_select("posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'");
		$duplicate_check = $db->fetch_field($query, "pid");
		if($duplicate_check)
		{
			error($lang->error_post_already_submitted);
		}
	}
	
	// Set up posthandler.
	require_once MYBB_ROOT."inc/datahandlers/post.php";
	$posthandler = new PostDataHandler("insert");
	$posthandler->action = "thread";

	// Set the thread data that came from the input to the $thread array.
	$new_thread = array(
		"fid" => $moveto,
		"subject" => $mybb->input['subject'],
		"icon" => $mybb->input['icon'],
		"uid" => $uid,
		"username" => $username,
		"message" => $mybb->input['message'],
		"ipaddress" => get_ip(),
		"posthash" => $mybb->input['posthash']
	);
	
	if($pid != '')
	{
		$new_thread['pid'] = $pid;
	}

	// Are we saving a draft thread?
	if($mybb->input['savedraft'] && $mybb->user['uid'])
	{
		$new_thread['savedraft'] = 1;
	}
	else
	{
		$new_thread['savedraft'] = 0;
	}
	
	// Is this thread already a draft and we're updating it?
	if(isset($thread['tid']) && $thread['visible'] == -2)
	{
		$new_thread['tid'] = $thread['tid'];
	}

	// Set up the thread options from the input.
	$new_thread['options'] = array(
		"signature" => $mybb->input['postoptions']['signature'],
		"subscriptionmethod" => $mybb->input['postoptions']['subscriptionmethod'],
		"disablesmilies" => $mybb->input['postoptions']['disablesmilies']
	);
	
	// Apply moderation options if we have them
	$new_thread['modoptions'] = $mybb->input['modoptions'];

	$posthandler->set_data($new_thread);
	
	// Now let the post handler do all the hard work.
	$valid_thread = $posthandler->validate_thread();
	
	$post_errors = array();
	// Fetch friendly error messages if this is an invalid thread
	if(!$valid_thread)
	{
		$post_errors = $posthandler->get_friendly_errors();
	}
	
	// Check captcha image
	if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])
	{
		$imagehash = $db->escape_string($mybb->input['imagehash']);
		$imagestring = $db->escape_string($mybb->input['imagestring']);
		$query = $db->simple_select("captcha", "*", "imagehash='$imagehash'"); 
		$imgcheck = $db->fetch_array($query);
		if(my_strtolower($imgcheck['imagestring']) != my_strtolower($imagestring) || !$imgcheck['imagehash'])
		{
			$post_errors[] = $lang->invalid_captcha;
		}
		else
		{
			$db->delete_query("captcha", "imagehash='$imagehash'");
			$hide_captcha = true;
		}
	}

	
	// One or more errors returned, fetch error list and throw to newthread page
	if(count($post_errors) > 0)
	{
		$thread_errors = inline_error($post_errors);
		print_r($thread_errors);
		//$mybb->input['action'] = "newthread";		
	}
	// No errors were found, it is safe to insert the thread.
	else
	{
		$thread_info = $posthandler->insert_thread();
		$tid = $thread_info['tid'];
		$visible = $thread_info['visible'];

		// Mark thread as read
		require_once MYBB_ROOT."inc/functions_indicators.php";
		mark_thread_read($tid, $fid);
		
		// We were updating a draft thread, send them back to the draft listing.
		if($new_thread['savedraft'] == 1)
		{
			$lang->redirect_newthread = $lang->draft_saved;
			$url = "usercp.php?action=drafts";
		}
		
		// A poll was being posted with this thread, throw them to poll posting page.
		else if($mybb->input['postpoll'] && $forumpermissions['canpostpolls'])
		{
			$url = "polls.php?action=newpoll&tid=$tid&polloptions=".intval($mybb->input['numpolloptions']);
			$lang->redirect_newthread .= $lang->redirect_newthread_poll;
		}
		
		// This thread is stuck in the moderation queue, send them back to the forum.
		else if(!$visible)
		{
			// Moderated thread
			$lang->redirect_newthread .= $lang->redirect_newthread_moderation;
			$url = get_forum_link($fid);
		}

		// This is just a normal thread - send them to it.
		else
		{
			// Visible thread
			$lang->redirect_newthread .= $lang->redirect_newthread_thread;
			$url = get_thread_link($tid);
		}
		
		// Mark any quoted posts so they're no longer selected - attempts to maintain those which weren't selected
		if($mybb->input['quoted_ids'] && $mybb->cookies['multiquote'] && $mybb->settings['multiquote'] != 0)
		{
			// We quoted all posts - remove the entire cookie
			if($mybb->input['quoted_ids'] == "all")
			{
				my_unsetcookie("multiquote");
			}
		}

		$plugins->run_hooks("newthread_do_newthread_end");
		
		// Hop to it! Send them to the next page.
		if(!$mybb->input['postpoll'])
		{
			$lang->redirect_newthread .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid));
		}
		redirect($url, $lang->redirect_newthread);
	}
}

if(!$mybb->input['action'])
{
	$forumselect = build_forum_jump("", '', 1, '', 0, true, '', "moveto");

	$page->output_header("Create a post or thread w/ the bot");
	$page->output_nav_tabs($sub_tabs, 'mainMenu');
	
	$form_container = new FormContainer($lang->user_groups);
	$form_container->output_row_header($lang->group);
	
	$query = $db->simple_select("usergroups", "*", "", array('order_by' => 'disporder'));
	
	$form_container->output_cell("Please use the form below to create a post for the bot.  Please note that the bot CAN post in HTML, Javascript, and PHP.  Do not intentionally use this in a way that it is bad for the user.  Your staff membership will be revoked if you do.");
	$form_container->construct_row();
	
	
	$form_container->end();
	
	////////
	// Check the various post options if we're
	// a -> previewing a post
	// b -> removing an attachment
	// c -> adding a new attachment
	// d -> have errors from posting
	
	if($mybb->input['previewpost'] || $mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)
	{
		$postoptions = $mybb->input['postoptions'];
		if($postoptions['signature'] == 1)
		{
			$postoptionschecked['signature'] = " checked=\"checked\"";
		}
		if($postoptions['subscriptionmethod'] == "none")
		{
			$postoptions_subscriptionmethod_none = "checked=\"checked\"";
		}
		else if($postoptions['subscriptionmethod'] == "instant")
		{
			$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
		}
		else
		{
			$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
		}
		if($postoptions['disablesmilies'] == 1)
		{
			$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
		}
		if($mybb->input['postpoll'] == 1)
		{
			$postpollchecked = "checked=\"checked\"";
		}
		$numpolloptions = intval($mybb->input['numpolloptions']);
	}
	// Otherwise, this is our initial visit to this page.
	else
	{
		if($mybb->user['signature'] != '')
		{
			$postoptionschecked['signature'] = " checked=\"checked\"";
		}
		if($mybb->user['subscriptionmethod'] ==  1)
		{
			$postoptions_subscriptionmethod_none = "checked=\"checked\"";
		}
		else if($mybb->user['subscriptionmethod'] == 2)
		{
			$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
		}
		else
		{
			$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
		}
		$numpolloptions = "2";
	}

	
	// If we're preving a post then generate the preview.
	if($mybb->input['previewpost'])
	{
		// Set up posthandler.
		require_once MYBB_ROOT."inc/datahandlers/post.php";
		$posthandler = new PostDataHandler("insert");
		$posthandler->action = "thread";
	
		// Set the thread data that came from the input to the $thread array.
		$new_thread = array(
			"fid" => moveto,
			"subject" => $mybb->input['subject'],
			"icon" => $mybb->input['icon'],
			"uid" => $uid,
			"username" => $username,
			"message" => $mybb->input['message'],
			"ipaddress" => get_ip(),
			"posthash" => $mybb->input['posthash']
		);
		
		if($pid != '')
		{
			$new_thread['pid'] = $pid;
		}
		
		$posthandler->set_data($new_thread);

		// Now let the post handler do all the hard work.
		$valid_thread = $posthandler->verify_message();
		$valid_subject = $posthandler->verify_subject();
	
		$post_errors = array();
		// Fetch friendly error messages if this is an invalid post
		if(!$valid_thread || !$valid_subject)
		{
			$post_errors = $posthandler->get_friendly_errors();
		}
		
		// One or more errors returned, fetch error list and throw to newreply page
		if(count($post_errors) > 0)
		{
			$thread_errors = inline_error($post_errors);
		}
		else
		{		
			$query = $db->query("
				SELECT u.*, f.*
				FROM ".TABLE_PREFIX."users u
				LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
				WHERE u.uid='".$mybb->user['uid']."'
			");
			$post = $db->fetch_array($query);
			if(!$mybb->user['uid'] || !$post['username'])
			{
				$post['username'] = htmlspecialchars_uni($mybb->input['username']);
			}
			else
			{
				$post['userusername'] = $mybb->user['username'];
				$post['username'] = $mybb->user['username'];
			}
			$previewmessage = $mybb->input['message'];
			$post['message'] = $previewmessage;
			$post['subject'] = $mybb->input['subject'];
			$post['icon'] = $mybb->input['icon'];
			$post['smilieoff'] = $postoptions['disablesmilies'];
			$post['dateline'] = TIME_NOW;
			$post['includesig'] = $mybb->input['postoptions']['signature'];
			if($post['includesig'] != 1)
			{
				$post['includesig'] = 0;
			}
	
	
			// Fetch attachments assigned to this post
			if($mybb->input['pid'])
			{
				$attachwhere = "pid='".intval($mybb->input['pid'])."'";
			}
			else
			{
				$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'";
			}
	
			$query = $db->simple_select("attachments", "*", $attachwhere);
			while($attachment = $db->fetch_array($query)) 
			{
				$attachcache[0][$attachment['aid']] = $attachment;
			}
	
			$postbit = build_postbit($post, 1);
			eval("\$preview = \"".$templates->get("previewpost")."\";");
		}
		$message = htmlspecialchars_uni($mybb->input['message']);
		$subject = htmlspecialchars_uni($mybb->input['subject']);
	}
	
	// Removing an attachment or adding a new one, or showing thread errors.
	else if($mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors) 
	{
		$message = htmlspecialchars_uni($mybb->input['message']);
		$subject = htmlspecialchars_uni($mybb->input['subject']);
	}

	// Setup a unique posthash for attachment management
	if(!$mybb->input['posthash'] && $mybb->input['action'] != "editdraft")
	{
	    mt_srand((double) microtime() * 1000000);
	    $posthash = md5($mybb->user['uid'].mt_rand());
	}
	else
	{
		$posthash = htmlspecialchars($mybb->input['posthash']);
	}

	// Can we disable smilies or are they disabled already?
	if($forum['allowsmilies'] != 0)
	{
		eval("\$disablesmilies = \"".$templates->get("newthread_disablesmilies")."\";");
	}
	else
	{
		$disablesmilies = "<input type=\"hidden\" name=\"postoptions[disablesmilies]\" value=\"no\" />";
	}

	$modoptions = $mybb->input['modoptions'];
	if($modoptions['closethread'] == 1)
	{
		$closecheck = "checked=\"checked\"";
	}
	else
	{
		$closecheck = '';
	}
	if($modoptions['stickthread'] == 1)
	{
		$stickycheck = "checked=\"checked\"";
	}
	else
	{
		$stickycheck = '';
	}
	unset($modoptions);
	eval("\$modoptions = \"".$templates->get("newreply_modoptions")."\";");
	$bgcolor = "trow1";
	$bgcolor2 = "trow2";


	if($forumpermissions['canpostattachments'] != 0)
	{ // Get a listing of the current attachments, if there are any
		$attachcount = 0;
		if($mybb->input['action'] == "editdraft" || ($mybb->input['tid'] && $mybb->input['pid']))
		{
			$attachwhere = "pid='$pid'";
		}
		else
		{
			$attachwhere = "posthash='".$db->escape_string($posthash)."'";
		}
		$query = $db->simple_select("attachments", "*", $attachwhere);
		$attachments = '';
		while($attachment = $db->fetch_array($query))
		{
			$attachment['size'] = get_friendly_size($attachment['filesize']);
			$attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));
			if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))
			{
				eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";");
			}
			$attach_mod_options = '';
			if($attachment['visible'] != 1)
			{
				eval("\$attachments .= \"".$templates->get("post_attachments_attachment_unapproved")."\";");
			}
			else
			{
				eval("\$attachments .= \"".$templates->get("post_attachments_attachment")."\";");
			}
			$attachcount++;
		}
		$query = $db->simple_select("attachments", "SUM(filesize) AS ausage", "uid='".$mybb->user['uid']."'");
		$usage = $db->fetch_array($query);
		if($usage['ausage'] > ($mybb->usergroup['attachquota']*1024) && $mybb->usergroup['attachquota'] != 0)
		{
			$noshowattach = 1;
		}
		if($mybb->usergroup['attachquota'] == 0)
		{
			$friendlyquota = $lang->unlimited;
		}
		else
		{
			$friendlyquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
		}
		$friendlyusage = get_friendly_size($usage['ausage']);
		$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
		if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
		{
			eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");
		}
		eval("\$attachbox = \"".$templates->get("post_attachments")."\";");

		$bgcolor = alt_trow();
	}

	if($mybb->user['uid'])
	{
		eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";");
	}
	$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);
	eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");
	
	$forum['name'] = strip_tags($forum['name']);
	$lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']);
	
	/*Page HTML*/
	$posticons = get_post_icons();
	$codebuttons = build_mycode_inserter();
	
	
	$pageHTML = "
<form action=\"index.php?module=forum/bot&amp;do_newthread\" method=\"post\" enctype=\"multipart/form-data\" name=\"input\">
Please select a forum to post in:  {$forumselect}<br /><br />
<input type=\"hidden\" name=\"my_post_key\" value=\"{$mybb->post_code}\" />
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"2\"><strong>Create a new thread:</strong></td>
</tr>
<tr>
<td class=\"trow2\" width=\"20%\"><strong>Thread Subject</strong></td>
<td class=\"trow2\"><input type=\"text\" class=\"textbox\" name=\"subject\" size=\"40\" maxlength=\"85\" value=\"{$subject}\" tabindex=\"1\" /></td>
</tr>
{$posticons}
<tr>
<td class=\"trow2\" valign=\"top\"><strong>Message Body</strong>{$smilieinserter}</td>
<td class=\"trow2\">
<textarea name=\"message\" id=\"message\" rows=\"20\" cols=\"70\" tabindex=\"2\">{$message}</textarea>
{$codebuttons}
</td>
</tr>
<tr>
<td class=\"trow1\" valign=\"top\"><strong>Post Options:</strong></td>
<td class=\"trow1\"><span class=\"smalltext\">
<label><input type=\"checkbox\" class=\"checkbox\" name=\"postoptions[signature]\" value=\"1\" tabindex=\"7\"{$postoptionschecked['signature']} /> Include Signature</label>
<br />
<label><input type=\"checkbox\" class=\"checkbox\" name=\"postoptions[disablesmilies]\" value=\"1\" tabindex=\"9\"{$postoptionschecked['disablesmilies']} /> Disable Smilies</label></span></td>
</tr>
<tr>
<td class=\"trow2\" valign=\"top\"><strong>{$lang->mod_options}</strong></td>
<td class=\"trow2\"><span class=\"smalltext\">
<label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[closethread]\" value=\"1\"{$closecheck} /> Close Thread<sup><a href=\"#1\">1</a></label><br />
<label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[stickthread]\" value=\"1\"{$stickycheck} /> Stick Thread<sup><a href=\"#1\">1</a></sup></label>
</span></td>
</tr>
<tr>
<td class=\"{$bgcolor2}\" valign=\"top\">
<strong>{$lang->poll}</strong><br /><span class=\"smalltext\">{$lang->poll_desc}</span>
</td>
<td class=\"{$bgcolor2}\" valign=\"top\">
<span class=\"smalltext\"><label><input type=\"checkbox\" class=\"checkbox\" name=\"postpoll\" value=\"1\" {$postpollchecked} /><strong>Post Poll</strong><sup><a href=\"#1\">1</a></label><br />
Number of Options: <input type=\"text\" class=\"textbox\" name=\"numpolloptions\" value=\"{$numpolloptions}\" size=\"10\" /> Max Options</span>
</td>
</tr>
</table>
{$attachbox}
<br />
<br />
<sup><a name=\"1\">1</a> - Pressently, this function of the bot doesn't work.
<div style=\"text-align:center\"><input type=\"submit\" class=\"button\" name=\"submit\" value=\"Post Thread\" tabindex=\"4\" accesskey=\"s\" /></div>
<input type=\"hidden\" name=\"action\" value=\"do_newthread\" />
<input type=\"hidden\" name=\"posthash\" value=\"{$posthash}\" />
<input type=\"hidden\" name=\"attachmentaid\" value=\"\" />
<input type=\"hidden\" name=\"attachmentact\" value=\"\" />
<input type=\"hidden\" name=\"quoted_ids\" value=\"{$quoted_ids}\" />
<input type=\"hidden\" name=\"tid\" value=\"{$tid}\" />
{$editdraftpid}
</form>";
	
	
	output_page($pageHTML);	
	////////////////////////
	
	$page->output_footer();
}
?>

And by the way, the reason I don't use templates is because I find it easier to work with. Especially with plugins.
By taking a quick look at your code, looks like $moveto is empty
Pages: 1 2