MDL-15184: fix sql injection vulnerability

This commit is contained in:
gbateson
2008-07-01 10:36:53 +00:00
parent d0356e72c3
commit 680c8b87e9
+9 -5
View File
@@ -380,10 +380,14 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
$select = "hotpot='$hotpot->id' AND status=".HOTPOT_STATUS_ABANDONED;
break;
case 'selection':
$ids = (array)data_submitted();
unset($ids['del']);
unset($ids['id']);
if (!empty($ids)) {
$ids = array();
$data = (array)data_submitted();
foreach ($data as $name => $value) {
if (preg_match('/^box\d+$/', $name)) {
$ids[] = intval($value);
}
}
if (count($ids)) {
$select = "hotpot='$hotpot->id' AND clickreportid IN (".implode(',', $ids).")";
}
break;
@@ -391,7 +395,7 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
// delete attempts using $select, if it is set
if ($select) {
$table = 'hotpot_attempts';
if ($attempts = get_records_select($table, $select)) {