提交 cf739b35 编写于 作者: D Daniel Veillard

better patch for the XSS search issue

Since the query string could be output when displaying the results too
上级 d51876bc
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
$scope = ltrim ($scope); $scope = ltrim ($scope);
if ($scope == "") if ($scope == "")
$scope = "any"; $scope = "any";
$querystr = htmlspecialchars($query, ENT_QUOTES, 'UTF-8');
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF'], "?query=", rawurlencode($query) ?>" <form action="<?php echo $_SERVER['PHP_SELF'], "?query=", rawurlencode($query) ?>"
enctype="application/x-www-form-urlencoded" method="get"> enctype="application/x-www-form-urlencoded" method="get">
<input name="query" type="text" size="50" value="<?php echo htmlspecialchars($query, ENT_QUOTES, 'UTF-8')?>"/> <input name="query" type="text" size="50" value="<?php echo $querystr ?>"/>
<select name="scope"> <select name="scope">
<option value="any">Search All</option> <option value="any">Search All</option>
<option value="API" <?php if ($scope == 'API') print "selected='selected'"?>>Only the APIs</option> <option value="API" <?php if ($scope == 'API') print "selected='selected'"?>>Only the APIs</option>
...@@ -200,7 +201,7 @@ ...@@ -200,7 +201,7 @@
} }
mysql_close($link); mysql_close($link);
$nb = count($results); $nb = count($results);
echo "<h3 align='center'>Found $nb results for query $query</h3>\n"; echo "<h3 align='center'>Found $nb results for query $querystr</h3>\n";
usort($results, "resSort"); usort($results, "resSort");
if ($nb > 0) { if ($nb > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册