diff --git a/config/categories.php b/config/categories.php index 18aed08..22f4480 100644 --- a/config/categories.php +++ b/config/categories.php @@ -7,7 +7,8 @@ { if($_POST['id'] && $_POST['category'] && $_POST['mingrade'] && $_POST['maxgrade']) { - $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."'"); + $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); + echo mysql_error(); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { echo error(i18n("Category ID %1 already exists",array($_POST['id']))); @@ -33,18 +34,19 @@ { if($_POST['id'] && $_POST['category'] && $_POST['mingrade'] && $_POST['maxgrade']) { - $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."'"); + $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { echo error(i18n("Category ID %1 already exists",array($_POST['id']))); } else { - mysql_query("INSERT INTO projectcategories (id,category,mingrade,maxgrade) VALUES ( ". + mysql_query("INSERT INTO projectcategories (id,category,mingrade,maxgrade,year) VALUES ( ". "'".$_POST['id']."', ". "'".mysql_escape_string(stripslashes($_POST['category']))."', ". "'".$_POST['mingrade']."', ". - "'".$_POST['maxgrade']."')"); + "'".$_POST['maxgrade']."', ". + "'".$config['FAIRYEAR']."')"); echo happy(i18n("Category successfully added")); } } @@ -81,7 +83,7 @@ if($_GET['action']=="edit") { echo "\n"; - $q=mysql_query("SELECT * FROM projectcategories WHERE id='".$_GET['edit']."'"); + $q=mysql_query("SELECT * FROM projectcategories WHERE id='".$_GET['edit']."' AND year='".$config['FAIRYEAR']."'"); $categoryr=mysql_fetch_object($q); $buttontext="Save"; } @@ -99,7 +101,7 @@ } else { - $q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade"); + $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade"); while($r=mysql_fetch_object($q)) { echo "