代码拉取完成,页面将自动刷新
<?php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
$pagetype = !empty($_REQUEST['pagetype']) ? trim($_REQUEST['pagetype']) : 'goods';
$id =!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : '0';
switch($pagetype)
{
case 'goods':
$pathrow = $db->getRow("select c.path_name,c.cat_id from ". $ecs->table('goods')." AS g left join ". $ecs->table('category') ." AS c on g.cat_id=c.cat_id where g.goods_id='$id'" );
$pathrow['path_name'] = $pathrow['path_name'] ? $pathrow['path_name'] : ("cat".$pathrow['cat_id']);
$pathrow['path_name'] = PREFIX_CATEGORY ."-".$pathrow['path_name'];
$url = $pathrow['path_name'] ."/goods-$id.html";
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
break;
case 'category':
$pathrow = $db->getRow("select path_name, cat_id from ". $ecs->table('category') ." where cat_id = '$id' " );
$pathrow['path_name'] = $pathrow['path_name'] ? $pathrow['path_name'] : ("cat".$pathrow['cat_id']);
$pathrow['path_name'] = PREFIX_CATEGORY ."-".$pathrow['path_name'];
$thisurl= $GLOBALS['ecs']->get_domain().$_SERVER['REQUEST_URI'];
$thisroot=$GLOBALS['ecs']->url();
$makeurl = str_replace($thisroot, '', $thisurl);
$makeurl = substr($makeurl, 0, strpos($makeurl, '.html')). ".html";
$url = $pathrow['path_name']. '/'.$makeurl;
//echo $url;
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
break;
case 'article':
$pathrow = $db->getRow("select c.path_name,c.cat_id from ". $ecs->table('article')." AS a left join ". $ecs->table('article_cat') ." AS c on a.cat_id=c.cat_id where a.article_id='$id'" );
$pathrow['path_name'] = $pathrow['path_name'] ? $pathrow['path_name'] : ("cat".$pathrow['cat_id']);
$pathrow['path_name'] = PREFIX_ARTICLECAT ."-".$pathrow['path_name'];
$url = $pathrow['path_name'] ."/article-$id.html";
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
break;
case 'article_cat':
$page = !empty($_REQUEST['page']) ? intval($_REQUEST['page']) : '0';
$sort = !empty($_REQUEST['sort']) ? trim($_REQUEST['sort']) : '';
$order = !empty($_REQUEST['order']) ? trim($_REQUEST['order']) : '';
$keywords = !empty($_REQUEST['keywords']) ? trim($_REQUEST['keywords']) : '';
$pathrow = $db->getRow("select path_name, cat_id from ". $ecs->table('article_cat') ." where cat_id='$id'" );
$pathrow['path_name'] = $pathrow['path_name'] ? $pathrow['path_name'] : ("cat".$pathrow['cat_id']);
$pathrow['path_name'] = PREFIX_ARTICLECAT ."-".$pathrow['path_name'];
$url = $pathrow['path_name'] ."/article_cat-".$id;
$url .= $page ? "-$page" : "";
if($keywords)
{
$url .= "-$keywords";
}
elseif($sort)
{
$url .= "-$sort";
$url .= $order ? "-$order" : "";
}
$url .= ".html";
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
break;
default:
break;
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。