Skip to content
Browse files

Fixed error if page id is missing

  • Loading branch information...
1 parent e7ca563 commit 962ca474bb2b722a36afecb9585994bd73195723 @trustmaster trustmaster committed
Showing with 8 additions and 5 deletions.
  1. +8 −5 modules/page/inc/page.main.php
View
13 modules/page/inc/page.main.php
@@ -26,12 +26,15 @@
}
/* ===== */
-$where = (!empty($al)) ? "page_alias='".$al."'" : 'page_id='.$id;
-$sql_page = $db->query("SELECT p.*, u.* FROM $db_pages AS p
- LEFT JOIN $db_users AS u ON u.user_id=p.page_ownerid
- WHERE $where LIMIT 1");
+if ($id > 0)
+{
+ $where = (!empty($al)) ? "page_alias='".$al."'" : 'page_id='.$id;
+ $sql_page = $db->query("SELECT p.*, u.* FROM $db_pages AS p
+ LEFT JOIN $db_users AS u ON u.user_id=p.page_ownerid
+ WHERE $where LIMIT 1");
+}
-if($sql_page->rowCount() == 0)
+if(!$id || $sql_page->rowCount() == 0)
{
$env['status'] = '404 Not Found';
cot_redirect(cot_url('message', 'msg=404', '', true));

0 comments on commit 962ca47

Please sign in to comment.
Something went wrong with that request. Please try again.