当前位置: 首页 > 图文教程 > 网络编程 > PHP > 是一个设计将LinuxFreak.org新闻标题放置到你的网站的PHP脚本程序。

PHP
随时给自己贴的图片加文字的php代码
一个可分页的基于文本的PHP留言板源码
一个简单的PHP投票程序源码
一个模仿oso的php论坛程序(之一)
一个模仿oso的php论坛程序源码(之二)
一个模仿oso的php论坛程序源码(之三)
dedecms 制作模板中使用的全局标记图文教程
一个简单的PHP&MYSQL留言板源码
PHP实现多服务器session共享之NFS共享的方法
随时给自己贴的图片加文字的php水印
php环境配置 php5 MySQL5 apache2 phpmyadmin安装与配置图文教程
火车头采集器3.0采集图文教程
用PHP生成静态HTML速度快类库
Discuz!插件:自动隐藏帖子
php中判断一个字符串包含另一个字符串的方法
dedecms后台验证码总提示错误的解决方法
加速XP搜索功能堪比vista
人尽可用的Windows技巧小贴士之下篇
PHP+Ajax 网站SEO查询工具 提供代码
用PHP实现的生成静态HTML速度快类库

是一个设计将LinuxFreak.org新闻标题放置到你的网站的PHP脚本程序。


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 100 ::
收藏到网摘: n/a

  <?php

//  bi bolo monggole huen !
//  
// v2.0.5
// <?
// include("linuxfreak.php3");
// ?>
//    dreamphp boy = sunboy

$link_prefix    =    "&nbsp;&nbsp;o ";
$link_postfix    =    "<BR>n";
$cache_file    =    "/tmp/linuxfreak2.cache";
$cache_time    =    1200;
$max_items    =    8;
$target        =    "_top";

//    End of customizations


$backend    =    "http://www.linuxfreak.org/backend/linuxfreak.rdf";

$items        =    0;
$time        =    split(" ", microtime());

srand((double)microtime()*1000000);
$cache_time_rnd    =    300 - rand(0, 600);

if ( (!(file_exists($cache_file))) || ((filectime($cache_file) + $cache_time - $time[1]) + $cache_time_rnd < 0) || (!(filesize($cache_file))) ) {

    $fpread = fopen($backend, 'r');
    if(!$fpread) {
    } else {

        $fpwrite = fopen($cache_file, 'w');
        if(!$fpwrite) {
        } else {

            while(! feof($fpread) ) {

                $buffer = ltrim(Chop(fgets($fpread, 256)));

                if (($buffer == "<item>") && ($items < $max_items)) {
                    $title = ltrim(Chop(fgets($fpread, 256)));
                    $link = ltrim(Chop(fgets($fpread, 256)));

                    $title = ereg_replace( "<title>", "", $title );
                    $title = ereg_replace( "</title>", "", $title );
                    $link = ereg_replace( "<link>", "", $link );
                    $link = ereg_replace( "</link>", "", $link );

                    fputs($fpwrite, "$link_prefix<A HREF="$link" TARGET="$target">$title</A>$link_postfix");

                    $items++;
                }
            }
        }
        fclose($fpread);
    }