<?php
/**
*
* @package phpBB3
* @version $Id: search.php,v 1.212 2007/10/05 14:30:06 acydburn Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);



// Define initial vars
$keywords		= utf8_normalize_nfc(request_var('keywords', '', true));
$search_forum	= (isset($_GET['fid'])) ? request_var('fid', 0) : 0;


if ($keywords)
{
	if($search_forum==0){
		$subsql='';
	}
	else
	{
		$subsql=' and forum_id ='.$search_forum;
	}

	$sql = 'SELECT * FROM ' . TOPICS_TABLE . ' WHERE topic_title = "' . $keywords .'" '. $subsql . ' LIMIT 1';
		
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
	if($row['topic_title']){
		echo('1');
	}
	else
	{	echo('0');
	}
	exit;
}


?>