summaryrefslogtreecommitdiffstats
path: root/products.php
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-05-11 14:54:29 +0200
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-05-11 14:54:29 +0200
commit1bb6c3bc23d08851f6af786f516b3cbc73a6f391 (patch)
treecafd4ccffd63f1c2f926da5637550eea66ff8b52 /products.php
parentfe9768f784a1dd333939070ac3940fba30ab0aaa (diff)
downloadCatalog-1bb6c3bc23d08851f6af786f516b3cbc73a6f391.tar.gz
Catalog-1bb6c3bc23d08851f6af786f516b3cbc73a6f391.zip
Check for wrong ids
Diffstat (limited to 'products.php')
-rw-r--r--products.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/products.php b/products.php
index b8391d9..1591799 100644
--- a/products.php
+++ b/products.php
@@ -9,7 +9,11 @@ else
}
require_once('vendor.inc.php');
-$category = CategoryQuery::create()->filterById($id)->findOne();
+$category = CategoryQuery::create()->findOneById($id);
+if ( !is_object($category) )
+{
+ header('Location: categories.php');
+}
$products = $category->getProducts();
?>
<!DOCTYPE html>
@@ -33,7 +37,7 @@ $products = $category->getProducts();
<dl>
<?php
foreach( $products as $product ){
- echo "<dt><a href=\"productdetails.php?id={$product->getId()}\">{$product->getName()}</a></dt>";
+ echo "<dt><a href=\"productdetails.php?id={$product->getId()}&catid={$id}\">{$product->getName()}</a></dt>";
echo "<dd>{$product->getDescription()}</dd>";
}
?>