diff --git a/main/admin/settings.php b/main/admin/settings.php
index 9c979e3c32..dfb9727360 100644
--- a/main/admin/settings.php
+++ b/main/admin/settings.php
@@ -1,5 +1,5 @@
"Plugins" and $_GET['category'] <
$renderer = & $form->defaultRenderer();
$renderer->setHeaderTemplate('
{header}
'."\n");
$renderer->setElementTemplate(''."\n".'{element}
'."\n");
- $sqlsettings = "SELECT DISTINCT * FROM $table_settings_current WHERE category='".$_GET['category']."' GROUP BY variable ORDER BY id ASC";
+ $my_category = mysql_real_escape_string($_GET['category']);
+ $sqlsettings = "SELECT DISTINCT * FROM $table_settings_current WHERE category='$my_category' GROUP BY variable ORDER BY id ASC";
$resultsettings = api_sql_query($sqlsettings, __FILE__, __LINE__);
while ($row = mysql_fetch_array($resultsettings))
{
@@ -129,7 +130,7 @@ if ($_GET['category'] and $_GET['category'] <> "Plugins" and $_GET['category'] <
// the first step is to set all the variables that have type=checkbox of the category
// to false as the checkbox that is unchecked is not in the $_POST data and can
// therefore not be set to false
- $sql = "UPDATE $table_settings_current SET selected_value='false' WHERE category='".mysql_real_escape_string($_GET['category'])."' AND type='checkbox'";
+ $sql = "UPDATE $table_settings_current SET selected_value='false' WHERE category='$my_category' AND type='checkbox'";
$result = api_sql_query($sql, __FILE__, __LINE__);
// Save the settings
foreach ($values as $key => $value)