<?
define('ROOT','../..');
define('AJAX',true);
ob_start('ob_gzhandler');

require_once(ROOT.'/.config.php');
require_once(LIBS_PATH.'/system/sys_start.php');
require_once(LIBS_PATH.'/system/load_libs.php');
$X->STR->post_filter();

header('Content-type: text/javascript');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');


$q=strip_tags(addslashes($_GET['q']));

$sql=$X->DB->query('
	SELECT
		id,
		title
	FROM produkty
	WHERE title LIKE "%'.$q.'%" OR kod LIKE "%'.$q.'%"
	ORDER BY title, id
	LIMIT 30
');
while($dane=$X->DB->fa($sql)) {
	echo $X->STR->out($dane['title']).'|'.$dane['id'].'
';
}
?>