Index: /branches/comu-ver2/data/class/util/SC_Utils.php
===================================================================
--- /branches/comu-ver2/data/class/util/SC_Utils.php	(revision 18100)
+++ /branches/comu-ver2/data/class/util/SC_Utils.php	(revision 18142)
@@ -269,4 +269,16 @@
     }
 
+    /*
+     * 桁が0で埋められているかを判定する
+     * 
+     * @param string $value 検査対象
+     * @return boolean 0で埋められている
+     */
+    function sfIsZeroFilling($value) {
+        if (strlen($value) > 1 && $value{0} === '0')
+            return true;
+        return false;
+    }
+
     function sfCSVDownload($data, $prefix = ""){
 
Index: /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php	(revision 18101)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php	(revision 18142)
@@ -73,4 +73,7 @@
      */
     function process() {
+        // カテゴリIDの正当性チェック
+        $this->lfCheckCategoryId();
+
         $objView = new SC_SiteView();
         $conn = new SC_DBConn();
@@ -220,4 +223,7 @@
      */
     function mobileProcess() {
+        // カテゴリIDの正当性チェック
+        $this->lfCheckCategoryId();
+
         $objView = new SC_MobileView();
         $conn = new SC_DBConn();
@@ -369,4 +375,17 @@
     function destroy() {
         parent::destroy();
+    }
+
+    /* カテゴリIDの正当性チェック */
+    function lfCheckCategoryId() {
+        $objDb = new SC_Helper_DB_Ex();
+        $category_id = $_POST['category_id'] ? $_POST['category_id'] : $_GET['category_id'];
+        if (!defined('MOBILE_SITE') && !isset($_REQUEST['category_id']))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+        if ($category_id
+                && (!SC_Utils_Ex::sfIsInt($category_id)
+                || SC_Utils_Ex::sfIsZeroFilling($category_id)
+                || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
     }
 
Index: /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18069)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18142)
@@ -78,4 +78,7 @@
      */
     function process() {
+        // プロダクトIDの正当性チェック
+        $product_id = $this->lfCheckProductId();
+
         $objView = new SC_SiteView();
         $objCustomer = new SC_Customer();
@@ -114,25 +117,4 @@
         $this->lfInitFile();
 
-        // 管理機能からの確認の場合は、非公開の商品も表示する。
-        if(isset($_GET['admin']) && $_GET['admin'] == 'on') {
-            SC_Utils_Ex::sfIsSuccess(new SC_Session());
-            $status = true;
-            $where = "del_flg = 0";
-        } else {
-            $status = false;
-            $where = "del_flg = 0 AND status = 1";
-        }
-
-        if(isset($_POST['mode']) && $_POST['mode'] != "") {
-            $tmp_id = $_POST['product_id'];
-        } else {
-            $tmp_id = $_GET['product_id'];
-        }
-
-        // 値の正当性チェック
-        if(!SC_Utils_Ex::sfIsInt($_GET['product_id'])
-                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
-            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-        }
         // ログイン判定
         if ($objCustomer->isLoginSuccess() === true) {
@@ -151,5 +133,5 @@
             if ($rpcnt < CUSTOMER_READING_MAX){
                 //閲覧履歴に新規追加
-                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
             } else {
                 //閲覧履歴の中で一番古いものを削除して新規追加
@@ -161,15 +143,14 @@
                 $objQuery->delete($table, $where, $arrval);
                 //追加
-                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
             }
         */
         }
 
-
         // 規格選択セレクトボックスの作成
-        $this->lfMakeSelect($tmp_id);
+        $this->lfMakeSelect($product_id);
 
         // 商品IDをFORM内に保持する。
-        $this->tpl_product_id = $tmp_id;
+        $this->tpl_product_id = $product_id;
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
@@ -223,10 +204,10 @@
         $objQuery = new SC_Query();
         // DBから商品情報を取得する。
-        $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $tmp_id));
+        $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $product_id));
         $this->arrProduct = $arrRet[0];
 
         // 商品コードの取得
         $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
-        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
+        $arrProductCode = $objQuery->getall($code_sql, array($product_id));
         $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
         $this->arrProductCode = $arrProductCode["product_code"];
@@ -243,5 +224,5 @@
         
         // 関連カテゴリを取得
-        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($tmp_id);
+        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($product_id);
         
         // 画像ファイル指定がない場合の置換処理
@@ -257,5 +238,5 @@
         $this->arrForm = $this->objFormParam->getFormParamList();
         //レビュー情報の取得
-        $this->arrReview = $this->lfGetReviewData($tmp_id);
+        $this->arrReview = $this->lfGetReviewData($product_id);
         // トラックバック情報の取得
 
@@ -265,11 +246,11 @@
         } else {
             $this->arrTrackbackView = "ON";
-            $this->arrTrackback = $this->lfGetTrackbackData($tmp_id);
-        }
-        $this->trackback_url = TRACKBACK_TO_URL . $tmp_id;
+            $this->arrTrackback = $this->lfGetTrackbackData($product_id);
+        }
+        $this->trackback_url = TRACKBACK_TO_URL . $product_id;
         //関連商品情報表示
-        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
+        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
         //この商品を買った人はこんな商品も買っています
-        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);
+        $this->arrRelateProducts = $this->lfGetRelateProducts($product_id);
 
         $this->lfConvertParam();
@@ -306,4 +287,7 @@
      */
     function mobileProcess() {
+        // プロダクトIDの正当性チェック
+        $product_id = $this->lfCheckProductId();
+        
         $objView = new SC_MobileView();
         $objCustomer = new SC_Customer();
@@ -323,18 +307,4 @@
         $this->lfInitFile();
 
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
-        if(!empty($_POST['mode'])) {
-            $tmp_id = $_POST['product_id'];
-        } else {
-            $tmp_id = $_GET['product_id'];
-        }
-
-        // 値の正当性チェック
-        if(!SC_Utils_Ex::sfIsInt($tmp_id)
-                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, 'del_flg = 0 AND status = 1')) {
-            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-        }
-
         // ログイン判定
         if($objCustomer->isLoginSuccess(true)) {
@@ -353,5 +323,5 @@
                if ($rpcnt < CUSTOMER_READING_MAX){
                //閲覧履歴に新規追加
-               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
                } else {
                //閲覧履歴の中で一番古いものを削除して新規追加
@@ -363,5 +333,5 @@
                $objQuery->delete($table, $where, $arrval);
                //追加
-               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
                }
             */
@@ -370,8 +340,8 @@
 
         // 規格選択セレクトボックスの作成
-        $this->lfMakeSelectMobile($this, $tmp_id);
+        $this->lfMakeSelectMobile($this, $product_id);
 
         // 商品IDをFORM内に保持する。
-        $this->tpl_product_id = $tmp_id;
+        $this->tpl_product_id = $product_id;
 
         switch($_POST['mode']) {
@@ -447,10 +417,10 @@
         $objQuery = new SC_Query();
         // DBから商品情報を取得する。
-        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
+        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($product_id));
         $this->arrProduct = $arrRet[0];
 
         // 商品コードの取得
         $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
-        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
+        $arrProductCode = $objQuery->getall($code_sql, array($product_id));
         $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
         $this->arrProductCode = $arrProductCode["product_code"];
@@ -479,14 +449,49 @@
         $this->arrForm = $this->objFormParam->getFormParamList();
         //レビュー情報の取得
-        $this->arrReview = $this->lfGetReviewData($tmp_id);
+        $this->arrReview = $this->lfGetReviewData($product_id);
         // タイトルに商品名を入れる
         $this->tpl_title = "商品詳細 ". $this->arrProduct["name"];
         //関連商品情報表示
-        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
+        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
         //この商品を買った人はこんな商品も買っています
-        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);
+        $this->arrRelateProducts = $this->lfGetRelateProducts($product_id);
 
         $objView->assignobj($this);
         $objView->display(SITE_FRAME);
+    }
+
+    /* プロダクトIDの正当性チェック */
+    function lfCheckProductId() {
+        // 管理機能からの確認の場合は、非公開の商品も表示する。
+        if (isset($_GET['admin']) && $_GET['admin'] == 'on') {
+            SC_Utils_Ex::sfIsSuccess(new SC_Session());
+            $status = true;
+            $where = 'del_flg = 0';
+        } else {
+            $status = false;
+            $where = 'del_flg = 0 AND status = 1';
+        }
+
+        if (defined('MOBILE_SITE')) {
+            if (!isset($_POST['mode'])) $_POST['mode'] = "";
+            if (!empty($_POST['mode'])) {
+                $product_id = $_POST['product_id'];
+            } else {
+                $product_id = $_GET['product_id'];
+            }
+        } else {
+            if(isset($_POST['mode']) && $_POST['mode'] != '') {
+                $product_id = $_POST['product_id'];
+            } else {
+                $product_id = $_GET['product_id'];
+            }
+        }
+
+        $objDb = new SC_Helper_DB_Ex();
+        if(!SC_Utils_Ex::sfIsInt($product_id)
+            || SC_Utils_Ex::sfIsZeroFilling($product_id)
+            || !$objDb->sfIsRecord('dtb_products', 'product_id', (array)$product_id, $where))
+            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
+        return $product_id;
     }
 
@@ -779,8 +784,8 @@
 
     //閲覧履歴新規登録
-    function lfRegistReadingData($tmp_id, $customer_id){
+    function lfRegistReadingData($product_id, $customer_id){
         $objQuery = new SC_Query;
         $sqlval['customer_id'] = $customer_id;
-        $sqlval['reading_product_id'] = $tmp_id;
+        $sqlval['reading_product_id'] = $product_id;
         $sqlval['create_date'] = 'NOW()';
         $sqlval['update_date'] = 'NOW()';
@@ -789,5 +794,5 @@
 
     //この商品を買った人はこんな商品も買っています FIXME
-    function lfGetRelateProducts($tmp_id) {
+    function lfGetRelateProducts($product_id) {
         $objQuery = new SC_Query;
         //自動抽出
@@ -799,5 +804,5 @@
         $from = "vw_products_allclass AS allcls ";
         $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
-        $arrval[] = $tmp_id;
+        $arrval[] = $product_id;
         //結果の取得
         $arrProducts = $objQuery->select($col, $from, $where, $arrval);
Index: /branches/comu-ver2/data/class/pages/products/LC_Page_Products_CategoryList.php
===================================================================
--- /branches/comu-ver2/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 16582)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 18142)
@@ -70,4 +70,7 @@
      */
     function mobileProcess() {
+        // カテゴリIDの正当性チェック
+        $this->lfCheckCategoryId();
+        
         $objView = new SC_MobileView();
 
@@ -90,4 +93,17 @@
     function destroy() {
         parent::destroy();
+    }
+
+    /* カテゴリIDの正当性チェック */
+    function lfCheckCategoryId() {
+        $objDb = new SC_Helper_DB_Ex();
+        $category_id = $_POST['category_id'] ? $_POST['category_id'] : $_GET['category_id'];
+        if (!defined('MOBILE_SITE') && !isset($_REQUEST['category_id']))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+        if ($category_id
+                && (!SC_Utils_Ex::sfIsInt($category_id)
+                || SC_Utils_Ex::sfIsZeroFilling($category_id)
+                || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
     }
 
