建了一个新的点卡站,711点卡便利店

建了一个新的点卡站,711点卡便利店
百度蜘蛛快点来爬一下啊,一直不收录,发发博客文章看看你收录不。
就是这个网站了http://www.711dianka.com 711点卡

Ecshop 多语言 告诉你到底多简单

Ecshop 多语言 告诉你到底多简单
打开includds/init.php 粘贴代码到200行左右if (!defined(‘INIT_NO_USERS’)) 上面

if(!empty($_REQUEST['lang'])){
 $_SESSION['lang']=$_REQUEST['lang'];
}
if (!empty($_SESSION['lang']))
{
 switch($_SESSION['lang']){
  case 'zh_cn':
   $_CFG['lang']="zh_cn";
  break;
  case 'zh_tw':
   $_CFG['lang']="zh_tw";
  break;
  case 'en_us':
   $_CFG['lang']="en_us";
  break;
 }

}
require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);

删除原

require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);

页面调用

<a href="?lang=zh_cn">简体</a>
<a href="?lang=zh_tw">繁体</a>
<a href="?lang=en_us">英文</a>

转-ECSHOP所有文件注释-二次开发使用

转-ECSHOP所有文件注释-二次开发使用
Ecshop文件结构

ecshop文件架构说明
/*
ECShop 2.5.1 的结构图及各文件相应功能介绍
ECShop2.5.1_Beta upload 的目录
┣ activity.php 活动列表
┣ affiche.php 广告处理文件
┣ affiliate.php 生成商品列表
┣ article.php 文章内容
┣ article_cat.php文章分类
┣ auction.php 拍卖前台文件
┣ brand.php 品牌列表
┣ captcha.php 生成验证码
┣ catalog.php 列出所以分类及品牌
┣ category.php 商品分类
┣ comment.php 提交用户评论
┣ compare.php 商品比较程序
┣ cycle_image.php 轮播图片程序
┣ feed.php RSS Feed 生成程序
┣ flow.php 购物流程
┣ gallery.php 商品相册
┣ goods.php 商品详情
┣ goods_script.php 生成商品列表
┣ group_buy.php 团购商品前台文件
┣ index.php 首页文件
┣ myship.php 支付配送DEMO
┣ pick_out.php 选购中心
┣ receive.php 处理收回确认的页面
┣ region.php 地区切换程序
┣ respond.php 支付响应页面
┣ robots.txt
┣ search.php 搜索程序
┣ sitemaps.php google sitemap 文件
┣ snatch.php 夺宝奇兵前台页面
┣ tag_cloud.php 标签云
┣ topic.php 专题前台
┣ user.php 会员中心
┣ vote.php 调查程序
┣ wholesale.php 批发前台文件
┣ admin文件夹
┃ ┣ account_log.php 管理中心帐户变动记录
┃ ┣ admin_logs.php 记录管理员操作日志
┃ ┣ ads.php 广告管理程序
┃ ┣ adsense.php 站外JS投放的统计程序
┃ ┣ ad_position.php广告位置管理程序
┃ ┣ affiliate.php 程序说明
┃ ┣ affiliate_ck.php 程序说明
┃ ┣ agency.php 管理中心办事处管理
┃ ┣ area_manage.php 地区列表管理文件
┃ ┣ article.php 管理中心文章处理程序文件
┃ ┣ articlecat.php 文章分类管理程序
┃ ┣ article_auto.php
┃ ┣ attention_list.php
┃ ┣ attribute.php 属性规格管理
┃ ┣ auction.php 管理中心拍卖活动管理
┃ ┣ bonus.php 红包类型的处理
┃ ┣ brand.php管理中心品牌管理
┃ ┣ captcha_manage.php
┃ ┣ card.php 贺卡管理程序
┃ ┣ category.php 商品分类管理程序
┃ ┣ check_file_priv.php 系统文件检测
┃ ┣ comment_manage.php 用户评论管理程序
┃ ┣ convert.php 转换程序
┃ ┣ cron.php 计划任务
┃ ┣ database.php 数据库管理
┃ ┣ ebao_commend.php 易宝推荐
┃ ┣ edit_languages.php 管理中心语言项编辑(前台语言项)
┃ ┣ email_list.php 邮件列表管理
┃ ┣ favourable.php 管理中心优惠活动管理
┃ ┣ flashplay.php
┃ ┣ flow_stats.php 综合流量统计
┃ ┣ friend_link.php 友情链接管理
┃ ┣ gen_goods_script.php 生成显示商品的js代码
┃ ┣ get_password.php 找回管理员密码
┃ ┣ goods.php 商品管理程序
┃ ┣ goods_auto.php
┃ ┣ goods_batch.php 商品批量上传、修改
┃ ┣ goods_booking.php 缺货处理管理程序
┃ ┣ goods_export.php
┃ ┣ goods_type.php 商品类型管理程序
┃ ┣ group_buy.php 管理中心团购商品管理
┃ ┣ guest_stats.php 客户统计
┃ ┣ index.php 控制台首页
┃ ┣ integrate.php 第三方程序会员数据整合插件管理程序
┃ ┣ magazine_list.php
┃ ┣ mail_template.php 管理中心模版管理程序
┃ ┣ message.php 管理中心管理员留言程序
┃ ┣ navigator.php
Read more…

替换数据库中的字段

今天打算修改商品页描述中的 服务时间,需要全部页面修改,手工更新累死人了,于是想着再MYSQL里直接修改,
使用这个语句,就可以轻松解决问题,其中content为表名,desc为字段名, viewthread.php?tid=11&extra=page%3D1为要替换的内容, http://www.sina.com为新的内容.
update content set desc=replace(desc, “viewthread.php?tid=11&extra=page%3D1″, ” http://www.sina.com”)

转一篇PHP实现倒计时功能

转一篇PHP实现倒计时功能
这几天公司要做一个限时购物的功能.
这就要做到倒计时,要有实时的倒计时.
要求:
1) 要有小时分钟秒的实时倒计时的显示
2)用户端修改日期时间不会影响到倒计时的正常显示(也就是以服务器时间为准)
其实这和很多的考试等系统的时间限制功能同样的要求.
解决思路:
1)总不能用ajax每秒都获取服务器时间吧.
所以实时倒计时一定要用javascript实现.这很简单.网上一大把的例子.
2)现在问题是解决用户端修改日期时间对我们的显示的影响.
解决的办法是计算出用户端的时间和服务器的时间差.这样问题的完成解决了.
这样只需要运行一次php.实时倒计时的时间就和服务器的时间同步了.
理论是同步的,但实际测试会有1秒的误差.(具体原因就是和网速有关,网速越快,误差就越小),但这决不会影响到我们上面的要求了.

实例:

<?php
/**************************************
**功能:PHP实时倒计时
**创建日期:2009-2-26
**作者:潘继强 <panjeck@tom.com>
**
***************************************/
//php的时间是以秒算。js的时间以毫秒算
date_default_timezone_set("Asia/Hong_Kong");//地区
//配置每天的活动时间段
$starttimestr = "09:00:00";
$endtimestr = "18:30:00";
$starttime =  strtotime($starttimestr);
$endtime  =   strtotime($endtimestr);
$nowtime  =   time();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP实时倒计时!</title>
<script language="JavaScript">
<!-- //
var EndTime=<?=$endtime*1000?>;
var NowTime = new Date();
//计算出服务器和客户端的时间差。
var dTime = <?=$nowtime*1000?>-NowTime.getTime();
function GetRTime(){
var NowTime = new Date();
var nMS = EndTime - NowTime.getTime()-dTime;
var nH=Math.floor(nMS/(1000*60*60)) % 24;
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
document.getElementById("RemainH").innerHTML=nH;
document.getElementById("RemainM").innerHTML=nM;
document.getElementById("RemainS").innerHTML=nS;
if(nMS>5*59*1000&&nMS<=5*60*1000)
{
  alert("还有最后五分钟!");
}
setTimeout("GetRTime()",1000);
}
window.onload=GetRTime;
// -->
</script>
</head>
<body>
  <h1><strong id="RemainH">XX</strong>:<strong id="RemainM">XX</strong>:<strong id="RemainS">XX</strong></h1>
</body>
</html>

实例2:
修改了上面的一些bug

<?php
/**************************************
**功能:PHP实时倒计时
**创建日期:2009-2-26
**作者:潘继强 <panjeck@tom.com>
**
***************************************/
//php的时间是以秒算。js的时间以毫秒算

date_default_timezone_set("Asia/Hong_Kong");//地区

//配置每天的活动时间段
$starttimestr = "09:00:00";
$endtimestr = "18:30:00";
$starttime =  strtotime($starttimestr);
$endtime  =   strtotime($endtimestr);
$nowtime  =   time();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP实时倒计时!</title>
<script language="JavaScript">
<!-- //
var EndTime=<?=$endtime*1000?>;
var NowTime = new Date();
//计算出服务器和客户端的时间差。
var dTime = NowTime.getTime()-<?=$nowtime*1000?>;
var runtimes = 0;
function GetRTime(){
var NowTime = new Date();
var dTimeNew = NowTime.getTime()-<?=$nowtime*1000?>;
var dTimesM = Math.abs(Math.floor((dTimeNew-runtimes*1000-dTime)/1000));//客户端时间和服务器当前时间的差
if (dTimesM>1) {//如果用户修改了客户端时间,就重新load本页
   window.location.reload();
}
var nMS = EndTime - NowTime.getTime()+dTime;
var nH=Math.floor(nMS/(1000*60*60)) % 24;
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
document.getElementById("RemainH").innerHTML=nH;
document.getElementById("RemainM").innerHTML=nM;
document.getElementById("RemainS").innerHTML=nS;
if(nMS>5*59*1000&&nMS<=5*60*1000)
{
  alert("还有最后五分钟!");
}
runtimes++;

setTimeout("GetRTime()",1000);
}
window.onload=GetRTime;
// -->
</script>
</head>
<body>
  <h1><strong id="RemainH">XX</strong>:<strong id="RemainM">XX</strong>:<strong id="RemainS">XX</strong></h1>
</body>
</html>

实例3:
思路不同,简单多了.

<?php
/**************************************
**功能:PHP实时倒计时
**创建日期:2009-2-26
**作者:潘继强 <panjeck@tom.com>
**
***************************************/
//php的时间是以秒算。js的时间以毫秒算

date_default_timezone_set("Asia/Hong_Kong");//地区

//配置每天的活动时间段
$starttimestr = "09:00:00";
$endtimestr = "13:50:00";

$starttime =  strtotime($starttimestr);
$endtime  =   strtotime($endtimestr);
$nowtime  =   time();
if ($nowtime<$starttime){
die("活动还没开始,活动时间是:{$starttimestr}至{$endtimestr}");
}
$lefttime = $endtime-$nowtime;  //实际剩下的时间(秒)
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP实时倒计时!</title>
<script language="JavaScript">
<!-- //
var runtimes = 0;
function GetRTime(){
    var nMS = <?=$lefttime?>*1000-runtimes*1000;
var nH=Math.floor(nMS/(1000*60*60))%24;
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
document.getElementById("RemainH").innerHTML=nH;
document.getElementById("RemainM").innerHTML=nM;
document.getElementById("RemainS").innerHTML=nS;
if(nMS>5*59*1000&&nMS<=5*60*1000)
{
  alert("还有最后五分钟!");
}
runtimes++;
setTimeout("GetRTime()",1000);
}
window.onload=GetRTime;
// -->
</script>
</head>
<body>
  <h1><strong id="RemainH">XX</strong>:<strong id="RemainM">XX</strong>:<strong id="RemainS">XX</strong></h1>
</body>
</html>

转:ECSHOP多货币解决方案!支持汇率即时更新!

1、需要修改3个文件 ,添加一段数据(货币多就添加多个。)
2、具体步骤
后台sql 查询 运行

INSERT INTO `ecshop(数据库名)`.`ec(表前缀)_shop_config` (
`id` ,
`parent_id` ,
`code` ,
`type` ,
`store_range` ,
`store_dir` ,
`value` ,
`sort_order`
)
VALUES (
'910', '3', 'exchange_rate', 'text', '', '', '0.75', '1'
);

其中910 可以为904以上的任何数值,为了方便升级留空,选了910 ,0.75是任意的一个汇率值
exchange_rate为汇率字段
如果想用2个以上货币,再运行一次,910改为911,exchange_rate改为其他的一个字段比如exchange_rateb

3、修改文件

修改 includes\init.php

搜索

$_SESSION['discount']    = 1.00;

后面加上

if (isset($_REQUEST['er']))
 {
$_SESSION['exchange_rate'] = $_REQUEST['er'];
clear_all_files();
}

此处加上clear_all_files();以保证所有页面成功。 记得有2处session
修改 includes\lib_common.php
搜索

sprintf($GLOBALS['_CFG']['currency_format'], $price);

替换为

if ($_SESSION['exchange_rate'] == "USD")
{
return sprintf($GLOBALS['_CFG']['currency_format'], $price);
}
 else if ($_SESSION['exchange_rate'] == "EUR")
 {
return    str_replace("$","EUR",sprintf($GLOBALS['_CFG']['currency_format'], $price*$GLOBALS['_CFG']['exchange_rate']));
 }
else
{
return    sprintf($GLOBALS['_CFG']['currency_format'], $price);
}

解释一下:我的网站是默认 USD美元,哈哈,第二货币是欧元,此处只是在美元欧元直接切换,如果需要多的,自己加。
另外在此处可以利用一下的api直接读取当前汇率,只是我的本地主机测试速度慢,没有添加,需要童鞋加的拷贝一下代码

$yahoo = "http://download.finance.yahoo.com/d/quotes.html?s=USDEUR=X&f=l1";
$yahoocontent = @file_get_contents($yahoo);
$currency = number_format($yahoocontent, 2, '.', '');

然后把

$price*$GLOBALS['_CFG']['exchange_rate']

替换为:

$price*$currency


最后一个文件
修改模板文件\library \category_tree.lbi
加上一下代码

<div class="globalModule" id="historylist">
  <h3 class="currency"></h3>
  <script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

  <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
    <option value="?<?php echo$_SERVER["QUERY_STRING"]?>&er=USD" <?php if ($_SESSION['exchange_rate'] == "USD") {echo "selected";} ?>>US Dollar - USD</option>
    <option value="?<?php echo$_SERVER["QUERY_STRING"]?>&er=EUR" <?php if ($_SESSION['exchange_rate'] == "EUR") {echo "selected";} ?>>Euro - EUR</option>
  </select>
</div>

这个可以根据需要加在你想要的位置,此处是加在目录树里
具体的CSS自己写一下。哈哈
测试成功!

那个汇率后台是可以修改的

商店设置 -显示设置-页面最后一个

抓取汇率的代码,抓的雅虎的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>

<?
/*******************
抓取美元兑欧元汇率
1、抓取雅虎即时汇率
2、如果值为空抓取google汇率
3、如果google为空抓取dollars2euro.com汇率
4、如果值为空抓取百度汇率
5、如果值仍为空抓取路透社汇率
*******************/

$google = "http://www.google.com/search?q=dollars+to+euros";
$baidu = "http://www.baidu.com/s?wd=%C3%C0%D4%AA+%C5%B7%D4%AA+%BB%E3%C2%CA";
$yahoo = "http://finance.yahoo.com/q?s=USDEUR=X";
$dtoe = "http://www.dollars2euro.com/?C1=USD&C2=EUR";
$retoer = "http://cn.reuters.com/investing/currencies/quote?srcAmt=100.00&srcCurr=USD&destAmt=&destCurr=EUR";

//$cnt = 0;
//while($cnt<3 && ($gocontent = file_get_contents($google ))===FALSE) $cnt++; //google非即时
/*
$ctx = stream_context_create(array(      
'http' => array('timeout' => 10)      
)      
);  

                if (($gocontent = file_get_contents($google , 0 , $ctx)) == "") //google非即时
                {
                        if (($baicontent = file_get_contents($baidu , 0 , $ctx)) == "") //baidu非即时
                                {
                                        $yacontentt = file_get_contents($yahoo , 0 , $ctx); //雅虎即时
                                        preg_match('/<span[^>]*id="yfs_l10_usdeur=x"[^>]*>(.*?)<\/span>/si',$yacontentt,$yamatch);
                                        $currency = pregstring($yamatch[0]);
                                }
                                else
                                {
                                        preg_match('/<span[^>]*font-weight:bold[^>]*>(.*?)<\/span>/si',$baicontent,$baimatch);
                                        $baiducurrency = str_replace("1美元=","",$baimatch[0]);
                                        $currency = str_replace("欧元","",$baiducurrency);
                                }
                }
                else
                {
                        preg_match('/<h2[^>]*class=r[^>]*>(.*?)<\/h2>/si',$gocontent,$googlematch);
                        $currency = number_format(pregstring($googlematch[0]), 2, '.', '');
                }

*/
//if (($gocontent = file_get_contents($google , 0 , $ctx)) == "") //google非即时
//{
//        if (($baicontent = file_get_contents($baidu , 0 , $ctx)) == "") //google非即时
//                {
//                        $yacontentt = file_get_contents($yahoo , 0 , $ctx); //百度非即时
//                }
//}

//$baicontent = file_get_contents($baidu); //百度非即时
//$yacontentt = file_get_contents($yahoo); //雅虎即时
//$docontentt = file_get_contents($dtoe); //www.dollars2euro.com非即时
//$recontentt = file_get_contents($retoer); //路透社非即时

//preg_match('/<h2[^>]*class=r[^>]*>(.*?)<\/h2>/si',$gocontent,$match);
//preg_match('/<span[^>]*font-weight:bold[^>]*>(.*?)<\/span>/si',$baicontent,$baimatch);
//preg_match('/<span[^>]*id="yfs_l10_usdeur=x"[^>]*>(.*?)<\/span>/si',$yacontentt,$yamatch);
//preg_match('/<span[^>]*id="ctl00_ContentPlaceHolder1_Rates1_LabelC1Rates"[^>]*>(.*?)<\/span>/si',$docontentt,$domatch);
//preg_match('/<div[^>]*class="changeUp"[^>]*>(.*?)<\/div>/si',$recontentt,$rematch);

//$baidu = str_replace("1美元=","",$baimatch[0]);
//$baidu = str_replace("欧元","",$baidu);

                $yahoo = "http://download.finance.yahoo.com/d/quotes.html?s=USDEUR=X&f=l1";
                $yahoocontent = @file_get_contents($yahoo);
                $currency = number_format($yahoocontent, 2, '.', '');

echo $currency;

echo "google今天美元兑欧元汇率:".pregstring($match[0])."<br />";
echo "baidu今天美元兑欧元汇率:".pregstring($baiducurrency)."<br />";
echo "yahoo即时美元兑欧元汇率:".pregstring($yamatch[0])."<br />";
//echo "dollars2euro今天美元兑欧元汇率:".$domatch[0]."<br />";
//echo "re今天美元兑欧元汇率:".pregstring($rematch[0])."<br />";

//$docontentt = iconv("gb2312", "utf-8",$domatch[0]);

function pregstring( $str )
{
 $strtemp = trim($str);
 $search  = array(
 "|'|Uis",
 "|<script[^>]*?>.*?</script>|Uis",  // 去掉 javascript
 "|<[\/\!]*?[^<>]*?>|Uis",    // 去掉 HTML 标记
 "'&(quot|#34);'i",      // 替换 HTML 实体
 "'&(amp|#38);'i",
 "|,|Uis",
 "|[\s]{2,}|is",
 "[ ]isu",
 "|[$]|Uis",
 "| |Uis",
 "|1dollars|Uis",
 "|=|Uis",
 "|euros|Uis",
 );
 $replace = array(
 "`",
 "",
 "",
 "",
 "",
 "",
 " ",
 " ",
 " ",
 "",
 "",
 "",
 "",
 );
 $text = preg_replace($search, $replace, $strtemp);
 return $text;
}

?>
</body>
</html>

转自http://bbs.ecshop.com/thread-122440-1-1.html
我自己也测试了一下很容易 就修改好ECSHOP的多货币了,喜欢的朋友可以试试.对做外贸的有一定作用

ecshop 函数列表大全

lib_time.php
gmtime()
P: 获得当前格林威治时间的时间戳 /$0
server_timezone()
P: 获得服务器的时区 /$0
local_mktime($hour = NULL , $minute= NULL, $second = NULL, $month = NULL, $day = NULL, $year = NULL)
P: 生成一个用户自定义时区日期的GMT时间戳
local_date($format, $time = NULL)
P: 将GMT时间戳格式化为用户自定义时区日期
gmstr2time($str)
P: 转换字符串形式的时间表达式为GMT时间戳
local_strtotime($str)
P: 将一个用户自定义时区的日期转为GMT时间戳
local_gettime($timestamp = NULL)
P: 获得用户所在时区指定的时间戳
local_getdate($timestamp = NULL)
P: 获得用户所在时区指定的日期和时间信息
Read more…

PHP错误:Warning: Cannot modify header information – headers already sent by

PHP错误:Warning: Cannot modify header information – headers already sent by
今天再修改ECSHOP INIT.PHP 和LIB_COMMON.PHP 文件时突然意外出现这样的错误,怎么找都找不到原因,后来百度了一下发现原始保存文件的时候保存成了UTF-8-BOM 了,在EditPlus中把文件另存为没有BOM的UTF-8格式,就解决问题了.

ecshop 2.7.1 后台自定路径的操作教程

ecshop 2.7.1 后台自定路径的操作教程
安装完成后。
修改admin文件夹名称,然后在data/config.php
修改define(‘ADMIN_PATH’,'admin’);
两个要保持一致。

例如:
把admin文件更改成 admin123
然后把define(‘ADMIN_PATH’,'admin123′);
再保存就可以了

转一篇ecshop记录蜘蛛访问次数,支持google,baidu,yahoo,soso,等搜索引擎

全文引用好了,不过它有一处错误的地方,我用红字纠正一下

申明:此功能只限ECSHOP的网站程序有效,其它程序请不要使用

对于建站的朋友来说,每天蜘蛛到你的站上爬多次数多少,应该来说是比较重要的,但如果要自已每天去下网站里面的访问日志,相对来说有点麻烦,尤其对于那些电脑比较菜的站长来说,压根就是不可能的事情,因我的小站妈妈购物网 用的是ECSHOP的程序,该程序最大的好处是开源,于是小小研究了一下,发现其实该站已经统计了蜘蛛爬行的次数,只是没显示出来而已,于是加入了一个小功能,将统计数据显示出来了,以方便每天的爬行统计,下面是代码:

searchengine.php

<?php

/**
* ECSHOP 搜索引擎关键字统计
* ============================================
* 版权所有 2005-2008 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ===============================================
* $Author: testyang $
* $Id: searchengine_stats.php 15013 2008-10-23 09:31:42Z testyang $
*/

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');
require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/statistic.php');

/* act操作项的初始化 */
if (empty($_REQUEST['act']))
{
    $_REQUEST['act'] = 'view';
}
else
{
    $_REQUEST['act'] = trim($_REQUEST['act']);
}

if ($_REQUEST['act'] == 'view')
{
    admin_priv('client_flow_stats');

    /* 时间参数 */
    /* TODO: 时间需要改 */
    if (isset($_POST) && !empty($_POST))
    {
        $start_date = $_POST['start_date'];
        $end_date   = $_POST['end_date'];
    }
    else
    {
        $start_date = local_date('Y-m-d', strtotime('-1 week'));
        $end_date   = local_date('Y-m-d');
    }
    /* ------------------------------------- */
    /* --综合流量
    /* ------------------------------------- */
    $max = 0;

    $sql = "SELECT `date`, `count`, searchengine ".
            " FROM " .$ecs->table('searchengine').
            " WHERE date >= '$start_date' AND date <= '" .$end_date. "'";
    if (isset($_POST['filter']))
    {
        $sql .= ' AND '. db_create_in($_POST['filter'], 'searchengine');
    }

    $list=$GLOBALS['db']->getAll($sql);
// $sql=" SELECT searchengine". " FROM " .$ecs->table('searchengine')." GROUP BY searchengine LIMIT 0 , 30 ";
// $res = $db->query($sql);

    /* 模板赋值 */
    $smarty->assign('ur_here',      $_LANG['searchengine_stats']);
    $smarty->assign('list', $list);

    $searchengines = array(
        'GOOGLE'=>false,
        'GOOGLE ADSENSE'=>false,
        'BAIDU'=>false,
        'MSN'=>false,
        'YODAO'=>false,
        'YAHOO'=>false,
        'Yahoo China'=>false,
        'IASK'=>false,
        'SOGOU'=>false,
        'CUIL'=>false
    );

    if (isset($_POST['filter']))
    {
        foreach ($_POST['filter'] AS $v)
        {
            $searchengines[$v] = true;
        }
    }
    $smarty->assign('searchengines', $searchengines);

    /* 显示日期 */
    $smarty->assign('start_date',   $start_date);
    $smarty->assign('end_date',     $end_date);

    $smarty->assign('lang', $_LANG);
    /* 显示页面 */
    assign_query_info();
    $smarty->display('searchengine.htm');
}

?>

searchengine.htm,将此文件保存到admin\templates目录下面

<!-- $Id: searchengine.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<div class="form-div">
<form action="" method="post" id="selectForm">
     <div id="group">
       {$lang.start_date}&nbsp;&nbsp;
       <input name="start_date" value="{$start_date}" style="width:80px;" onclick="return showCalendar(this, '%Y-%m-%d', false, false, this);" />
       {$lang.end_date}&nbsp;&nbsp;
       <input name="end_date" value="{$end_date}" style="width:80px;" onclick="return showCalendar(this, '%Y-%m-%d', false, false, this);" />
       <br>{$lang.result_filter}&nbsp;
        {foreach from=$searchengines item=val key=sename}
        <label><input type="checkbox" value="{$sename}" name="filter[]" {if $val}checked{/if}>{$sename}</label>
        {/foreach}
        <input type="submit" name="submit" value="{$lang.query}" class="button" />
</form>
</div>

<div class="tab-div">
    <!-- tab bar -->
    <div id="tabbar-div">
      <p>
        <span class="tab-front" id="general-tab">{$lang.tab_keywords}</span>
      </p>
    </div>
    <!-- tab body -->
<div class="list-div" id="listDiv">
        <!-- 关键字 -->
<table width="100%" cellspacing="1" cellpadding="2" id="list-table">
<tr>
    <th width="30%">日期</th>
    <th width="40%">蜘蛛</th>
    <th width="30%">次数</th>

</tr>
{foreach from=$list item=val}
<tr>

<td>{$val.date}</td><td align="center">{$val.searchengine}</td><td align="center">{$val.count}</td>
</tr>
{/foreach}

</table>
    </div>
</div>

{insert_scripts files="tab.js"}

{literal}
<script type="Text/Javascript" language="JavaScript">
<!--
onload = function()
{
    // 开始检查订单
    startCheckOrder();
}
//-->
</script>
{/literal}
{include file="pagefooter.htm"}

修改admin/includes/inc_menu.php

加入:$modules['06_stats']['searchengine_stats'] = ’searchengine_stats.php?act=view’;
作者原文此处出错了,应该改为$modules['06_stats']['searchengine_stats'] = ’searchengine.php?act=view’;

修改inc_priv.php

加入:$purview['searchengine'] = ‘client_flow_stats’;

修改:languages\zh_cn\admin\common.php

加入:$_LANG['searchengine'] = ‘蜘蛛访问统计’;

呵呵,重新打开后台,你应该看到有蜘蛛访问统计这一菜单了,接下来怎么做就不用我说了哈

文章出处:http://blog.pconline.com.cn/flydragon/