require_once('phplib/common.php'); require_once('phplib/template.php'); require_once('phplib/product_lib.php'); $id = addslashes(trim(@$_GET['id'])); if($id == '') redirect('./'); $inPreviewMode = inAdminMode() && isset($_GET['preview']); mysql_open(); if($inPreviewMode) { $sql = "SELECT * FROM `pages` WHERE `id`='$id'"; } else { $sql = "SELECT * FROM `pages` WHERE `id`='$id' AND `enable`=1"; } if(! ($data = mysql_fetch_one($sql))) ShowMsg('您所查詢的頁面不存在或已被移除!', './', '回到首頁'); $products = array(); if($data['show_products'] != '') { $rule_string = ''; if(substr($data['show_products'], 0, 1) == '#') { $sql = "SELECT `rule`, `rule_B` FROM `promotion` WHERE `id`='" . addslashes(substr($data['show_products'], 1)) . "'"; if($promo = mysql_fetch_one($sql)) { $rule = array(); if($promo['rule'] != '') $rule[] = $promo['rule']; if($promo['rule_B'] != '') $rule[] = $promo['rule_B']; $rule_string = addslashes(implode('|', $rule)); } } else { $rule_string = addslashes($data['show_products']); } if($rule_string != '') { $sql = "SELECT * FROM `products` WHERE `id` REGEXP '^({$rule_string})' and `enable`=1 ORDER BY `id` ASC"; $products = mysql_fetch_all($sql); } } mysql_close(); //------- if($inPreviewMode) html_header_nocache(); html_header_1('', null, null, $data['title'], $data['desc']); html_upstartdna(); html_header_2(null, $data['script']); if($inPreviewMode) { echo '