diff --git a/src/App/components/template/Navbar.php b/src/App/components/template/Navbar.php index 7c4d21d837c21422bcaefa8fd5455bb7afaf9d04..100ecfca7a64edc4fcd360ecc369707c517a92e3 100644 --- a/src/App/components/template/Navbar.php +++ b/src/App/components/template/Navbar.php @@ -15,13 +15,13 @@ $title = str_replace('.php', '', $title); <li><a href="/register">Register</a></li> <?php elseif ($this->userRole === 1) : ?> <!-- Display "Cart", "Profile", and "Log out" when logged in as a user --> - <li <?php if ($title == "Cart") echo 'aria-current="page"'; ?>><a href="/cart">Cart</a></li> - <li <?php if ($title == "Profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> + <li <?php if ($title == "cart") echo 'aria-current="page"'; ?>><a href="/cart">Cart</a></li> + <li <?php if ($title == "profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> <li><a href="/logout">Log out</a></li> <?php elseif ($this->userRole === 2) : ?> <!-- Display "Category", "Profile", and "Log out" when logged in as admin --> - <li <?php if ($title == "Category") echo 'aria-current="page"'; ?>><a href="/category">Category</a></li> - <li <?php if ($title == "Profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> + <li <?php if ($title == "category") echo 'aria-current="page"'; ?>><a href="/category">Category</a></li> + <li <?php if ($title == "profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> <li><a href="/logout">Log out</a></li> <?php endif; ?> </ul> diff --git a/src/App/models/CategoryModel.php b/src/App/models/CategoryModel.php index f670ae272a10eaf9cce12ba282bd4600a5c1abc8..badf29f914885a201b7c6f8dcd322899267064dc 100644 --- a/src/App/models/CategoryModel.php +++ b/src/App/models/CategoryModel.php @@ -28,6 +28,7 @@ class CategoryModel extends Model{ } public function updateCategory($id, $name){ + if(strlen($name) > 25)throw new Exception('Category name is too long', 400); $stmt = $this->database->getConn()->prepare("UPDATE categories SET name = ? WHERE id = ?"); $stmt->bind_param("si", $name, $id);