Error adding report to list if no category is specified

ALWAYS exit; after a header("Location:");
This commit is contained in:
james 2007-12-11 18:23:15 +00:00
parent 53847c37bf
commit 5d81818815

View File

@ -60,6 +60,8 @@
if($category_exist != '') $category = $category_exist; if($category_exist != '') $category = $category_exist;
if($category) {
$type = $_POST['type']; $type = $_POST['type'];
if(!array_key_exists($type, $report_options['type']['values'])) { if(!array_key_exists($type, $report_options['type']['values'])) {
/* Invalid format, not possible unless someone manually /* Invalid format, not possible unless someone manually
@ -82,6 +84,13 @@
'$reports_id', '$category', '$comment', '$reports_id', '$category', '$comment',
'$type', '$stock' );"); '$type', '$stock' );");
header("Location: reports.php?edit=1"); header("Location: reports.php?edit=1");
exit;
}
else
{
header("Location: reports.php?edit=1&errormsg=nocategory");
exit;
}
} }
@ -105,6 +114,8 @@
} }
require_once("../ajax.inc.php"); require_once("../ajax.inc.php");
if($_GET['errormsg']=="nocategory")
echo error(i18n("You must select a category or type a new category name to add a report to your list"));
/* Load all the users reports */ /* Load all the users reports */
$q = mysql_query("SELECT reports_committee.*,reports.name $q = mysql_query("SELECT reports_committee.*,reports.name