Posted by ajh on 12/27/06 12:14
Thanks for your suggestions Erwin. I've turned on all the error
messages and done some minor debugging. Nothing that related to the
output though. The underlying program is a basic search engine - you
are right about the html output so I made that htmlentities change but
it didn't make a difference.
Here is the code:
<?php
define("PROG", "/blah/bling/query");
$crawl = "courses";
$indexfile = "$crawl.csv";
$crawldir = "$crawl";
$namesfile = "$crawl.names";
$rankfile = "$crawl.rank";
$maxhits = 10;
$querystr = escapeshellarg($_GET['query']);
// Check if querystr is present
if ($querystr!=NULL)
{
// Run the query
unset($out);
exec("echo " . $querystr . " | " . PROG . " -i $indexfile -d
$crawldir -n $namesfile -p $rankfile -m $maxhits", $out);
}
?>
<html>
<body bgcolor="#ffffff">
<br>
<br>
<form method="get" action="<?php print $_SERVER['PHP_SELF']?>">
<input name="query" type="text" size="50" maxlength="50">
<input type="button" value="submit" />
</form>
<br>
<br>
<?php
// show output
foreach ($out as $val)
{
echo htmlentities($val)."<br/>";
}
?>
</body>
</html>
Navigation:
[Reply to this message]
|