是一个设计将LinuxFreak.org新闻标题放置到你的网站的PHP脚本程序
来源:www.phpres.com 作者:Angelover 出处:www.phpres.com 2007-7-23 13:13:41 进入讨论组关 键 词:
脚本 程序 网站 放置 设计 一个 cache_file link fpread
// bi bolo monggole huen !
//
// v2.0.5
// <?
// include("linuxfreak.php3");
// ?>
// dreamphp boy = sunboy
$link_prefix = " 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);
}
fclose($fpwrite);
}
if (file_exists($cache_file)) {
include($cache_file);
}
?> 欢迎进入PHP开发资源论坛讨论。
相关文章
图文推荐
论 坛 资 源
·用PHP显示图片的EXIF信息
·显示数码图片的EXIF信息 Discuz插件ForDisc
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
·使用PHP伪造sessionid做防刷新功能
·显示数码图片的EXIF信息 Discuz插件ForDisc
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
·使用PHP伪造sessionid做防刷新功能
热门技术文档
·国外主流PHP框架评测
·用PHP显示图片的EXIF信息
·显示数码图片的EXIF信息 Discuz插件ForDisc
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
·用PHP显示图片的EXIF信息
·显示数码图片的EXIF信息 Discuz插件ForDisc
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
最新图文档
本站编辑推荐:(本站开通Delphi4PHP专区,欢迎进入论坛交流!)
- · 3分钟快速了解 Delphi for PHP 特色 (中文), PDF档
- · 购买Delphi for PHP的五大理由, PDF档
- · Delphi for PHP 使用规格介绍, PDF档
- · Delphi for PHP 問答集 (From CodeGear)
- · Delphi for PHP 产品价格表
编缉最近更新文章
网站赞助商
搜索您感兴趣的内容




