cvs: pearweb /public_html package-search.php
| From: | Richard Heyes | Date: | Mon, 27 May 2002 21:51:59 +0000 |
| Subject: | cvs: pearweb /public_html package-search.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4169@lists.php.net to get a copy of this message | ||
richard Mon May 27 17:51:59 2002 EDT
Modified files:
/pearweb/public_html package-search.php
Log:
* Use DB::quote instead of addslashes
Index: pearweb/public_html/package-search.php
diff -u pearweb/public_html/package-search.php:1.18 pearweb/public_html/package-search.php:1.19
--- pearweb/public_html/package-search.php:1.18 Mon May 27 10:31:01 2002
+++ pearweb/public_html/package-search.php Mon May 27 17:51:59 2002
@@ -2,8 +2,8 @@
/**
* Filename.......: package-search.php
* Project........: PEAR Website
- * Last Modified..: $Date: 2002/05/27 14:31:01 $
- * CVS Revision...: $Revision: 1.18 $
+ * Last Modified..: $Date: 2002/05/27 21:51:59 $
+ * CVS Revision...: $Revision: 1.19 $
*
* Searches for packages matching various user definable
* criteria including:
@@ -77,19 +77,19 @@
if (!empty($_GET['pkg_name'])) {
$searchwords = preg_split('/\s+/', $_GET['pkg_name']);
for ($i=0; $i<count($searchwords); $i++) {
- $searchwords[$i] = sprintf("name LIKE '%%%s%%'",
addslashes($searchwords[$i]));
+ $searchwords[$i] = sprintf("name LIKE %s", $dbh->quote('%' .
$searchwords[$i] . '%'));
}
$where[] = '(' . implode($bool, $searchwords) . ')';
}
// Build maintainer part of query
if (!empty($_GET['pkg_maintainer'])) {
- $where[] = sprintf("handle LIKE '%%%s%%'",
addslashes($_GET['pkg_maintainer']));
+ $where[] = sprintf("handle LIKE %s", $dbh->quote('%' .
$_GET['pkg_maintainer'] . '%'));
}
// Build category part of query
if (!empty($_GET['pkg_category'])) {
- $where[] = sprintf("category = '%s'",
addslashes($_GET['pkg_category']));
+ $where[] = sprintf("category = %s",
$dbh->quote($_GET['pkg_category']));
}
/**
@@ -145,6 +145,7 @@
WHERE p.id = m.package " . $where . "
GROUP BY p.id
ORDER BY p.name";
+
$result = $dbh->query($sql);
// Run through any results