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

@ -59,6 +59,8 @@
$comment = mysql_escape_string(stripslashes($_POST['comment']));
if($category_exist != '') $category = $category_exist;
if($category) {
$type = $_POST['type'];
if(!array_key_exists($type, $report_options['type']['values'])) {
@ -82,6 +84,13 @@
'$reports_id', '$category', '$comment',
'$type', '$stock' );");
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");
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 */
$q = mysql_query("SELECT reports_committee.*,reports.name