水善利万物而不争,处众人之所恶,故几于道。
天行健,君子以自强不息;地势坤,君子以厚德载物。
2012年5月14日 | 分类: MySQL,Nginx,PHP | 标签:

NSERT IGNOREINSERT INTO的区别就是前者会忽略数据库中已经存在的数据,如果数据库没有数据,就插入新的数据,如果有数据的话就跳过这条数据。这样就可以保留数据库中已经存在数据,达到在间隙中插入数据的目的。

本条语句主要用于从DiscuzX备份表恢复一些缺失的数据。

INSERT IGNORE INTO `discuz`.`ar_forum_post`
	SELECT * FROM `discuz_bak`.`ar_forum_post`
2012年4月24日 | 分类: Unix,Linux,BSD | 标签: ,
#删除7天前的文件
find /tmp -type f -mtime +7 -exec rm -f {} \;
#扩展阅读:
find /tmp -cmin -600 -size +10M
-cmin -600 # 是600分钟内创建的文件
-size +10M # 是大于10M的文件
#其他参数
-mtime -n +n # 按更改时间来查找文件,-n指n天以内,+n指n天以前
-atime -n +n # 按访问时间来查找文件,-n指n天以内,+n指n天以前
-ctime -n +n # 按创建时间来查找文件,-n指n天以内,+n指n天以前
-size -n +n # 按大小来查找文件,单位可以是b,c,w,k,M,G

详细参数可参考以前的一篇文章:http://iam.anrip.com/post/220

2012年4月19日 | 分类: 闲言杂语 | 标签:
Adsbot-Google Adsbot-Google
AlexaBot Alexa
AOLBot sqworm
BaiduBot Baiduspider
GoogleBot googlebot http://www.googlebot.com/bot.html
Googlebot-Image Googlebot-Image
Googlebot-Mobile Googlebot-Mobile
IasksBot iaskspider
LycosBot lycos
Mediapartners-Google Mediapartners-Google
MSN Bot msnbot http://search.msn.com/msnbot.htm
RobozillaBot robozilla
SohuBot sohu-search
SosoBot Sosospider
SougouBot Sogou web spider http://www.sogou.com/docs/help/webmasters.htm#07
Yahoo Slurp slurp http://help.yahoo.com/l/us/yahoo/search/webcrawler/index.html
Yahoo-AdCrawler AdCrawler
YoudaoBot YodaoBot http://www.yodao.com/help/webmaster/spider
2012年4月10日 | 分类: MySQL,Nginx,PHP | 标签:

出于某种特殊需要,可能必须把数据按照某字段重新进行物理位置排序。另外这样也可以达到压缩空闲空间的目的。

可使用如下SQL语句进行操作:

ALTER TABLE `表名` ORDER BY `字段` ASC;

实战,DiscuzX数据库中可使用如下语句整理记录顺序:

ALTER TABLE `xc_ucenter_members` ORDER BY `uid` ASC;
ALTER TABLE `xc_forum_post` ORDER BY `tid` ASC, `first` DESC, `pid` ASC;
2012年4月5日 | 分类: HTML,CSS,JS,PHP,SQL | 标签:

removeHorse.php

/**
 * removeHorse.php by  2012.4.5
 * 尛岢 kerring
 */
 
showDir(getcwd());
 
//获取目录列表
function showDir($filedir) {
  $i = 0;
  $dir = @ dir($filedir);
  while(($file = $dir->read()) != false) {
    if(is_dir($filedir."/".$file) && $file!="." && $file!="..") {
      showDir($filedir."/".$file);
    } else{
      if($file != '.' && $file != '..' && $file != 'removeHorse.php') {
        $pathinfo = pathinfo($file);
        if(isset($pathinfo['extension']) && strpos(':sst,html,htm,php', $pathinfo['extension'])) {
          $f[i] = file_get_contents($filedir."/".$file);
          if(strpos($f[i], 'window[')) {
            $content = compile($f[i]);
            if(file_put_contents($filedir."/".$file, $content))
            echo "<h3>{$filedir}/{$file}</h3>";
            //echo "<pre>{$content}</pre>";
            //if($i == 20) exit;
            $i++;
          }
        }
      }
    }
  }
  echo "清理文件{$i}个";
  $dir->close();
}
 
function compile($contents) {
  $contents = preg_replace(
    array(
      '/\r\n<script .+(window)?(\[\".*\"]|(\(\'.*\'\);)).+<\/script>\r\n/iUs',
      '/</script><script \s+src=\"http:\/\/(%\d\w\/?)*\">< \/script>/iUs'
    ),
    array('',''),
    $contents
  );
  return $contents;
}
</script>