require("init.php"); $bq = 'xiangqing'; if(empty($_GET['url'])){ $url = 'solution'; }else{ $url = $_GET['url']; } if($url == 'solution'){ $class_id = 107; }else{ $class_id = $db->getTableFieldValue('info_class', 'id', 'where url=\'' . $url . '\''); } if ( empty($class_id) || strlen($class_id) < 3 || (int)$db->getCount('info_class', "id='".$class_id."' limit 1") < 1 ) { $db->close(); header("location: ./"); exit; } $base_id = substr($class_id, 0, 3); $default_class_id = ''; if ( strlen($class_id) == 3 ) { // 只有base_id,默认第一个子栏目ID if ( (int)$db->getTableFieldValue('info_class', 'has_sub', 'where id=\'' . $class_id . '\' limit 1') > 0 ) { $sql = "select id, name, has_sub, webtitle, keyword, description, content from info_class where id like '".$class_id."___' order by sortnum asc limit 1"; $rst = $db->query($sql); $row = $db->fetch_array($rst); $class_id = $row['id']; $base_id = substr($class_id, 0, 3); $cont = $row['content']; $keyword = $row['keyword']; $webtitle = $row['webtitle']; $description = $row['description']; $base_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $base_id . '\' limit 1'); $second_id = $row['id']; $second_name = $row['name']; $third_id = ''; $third_name = ''; $default_class_id = $row['id']; } else { $db->close(); header("location: ./"); exit; } } elseif ( strlen($class_id) == 6 ) { if ( (int)$db->getTableFieldValue('info_class', 'has_sub', 'where id=\'' . $class_id . '\' limit 1') > 0 ) { $sql = "select id, name, has_sub, keyword, webtitle, description, content from info_class where id like '".$class_id."___' order by sortnum asc limit 1"; $rst = $db->query($sql); $row = $db->fetch_array($rst); $keyword = $row['keyword']; $webtitle = $row['webtitle']; $description = $row['description']; $cont = $row['content']; $base_id = substr($class_id, 0, 3); $base_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $base_id . '\' limit 1'); $second_id = substr($class_id, 0, 6); $second_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $second_id . '\' limit 1'); $third_id = $row['id']; $third_name = $row['name']; $default_class_id = $row['id']; $keyword = $db->getTableFieldValue('info_class', 'keyword', 'where id=\'' . $class_id . '\' limit 1'); $description = $db->getTableFieldValue('info_class', 'description', 'where id=\'' . $class_id . '\' limit 1'); $webtitle = $db->getTableFieldValue('info_class', 'webtitle', 'where id=\'' . $class_id . '\' limit 1'); $class_id = $row['id']; } else { $sql = "select id, name, has_sub, keyword, webtitle, description, content from info_class where id like '".$class_id."' order by sortnum asc limit 1"; $rst = $db->query($sql); $row = $db->fetch_array($rst); $class_id = $row['id']; $keyword = $row['keyword']; $description = $row['description']; $webtitle = $row['webtitle']; $cont = $row['content']; $base_id = substr($class_id, 0, 3); $base_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $base_id . '\' limit 1'); $second_id = substr($class_id, 0, 6); $second_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $second_id . '\' limit 1'); $third_id = ''; $third_name = ''; $default_class_id = $second_id; } } elseif ( strlen($class_id) == 9 ) { $base_id = substr($class_id, 0, 3); $second_id = substr($class_id, 0, 6); $third_id = substr($class_id, 0, 9); $base_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $base_id . '\' limit 1'); $second_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $second_id . '\' limit 1'); $third_name = $db->getTableFieldValue('info_class', 'name', 'where id=\'' . $third_id . '\' limit 1'); $default_class_id = $third_id; $keyword = $db->getTableFieldValue('info_class', 'keyword', 'where id=\'' . $third_id . '\' limit 1'); $description = $db->getTableFieldValue('info_class', 'description', 'where id=\'' . $third_id . '\' limit 1'); $webtitle = $db->getTableFieldValue('info_class', 'webtitle', 'where id=\'' . $third_id . '\' limit 1'); } $info_state = $db->getTableFieldValue('info_class', 'info_state', 'where id=\'' . $default_class_id . '\' limit 1'); ?>