当前位置: 首页 > 图文教程 > 网络编程 > PHP > php.net新闻拦截!

PHP
php 远程图片保存到本地的函数类
php 破解防盗链图片函数
快速开发一个PHP扩展图文教程
PHP6 mysql连接方式说明
php 进度条实现代码
php discuz 主题表和回帖表的设计
php 无限级缓存的类的扩展
php adodb操作mysql数据库
php FPDF类库应用实现代码
sourcesafe管理phpproj文件的补充说明(downmoon)
AspNetAjaxPager,Asp.Net通用无刷新Ajax分页控件,支持多样式多数据绑定
php一句话cmdshell新型 (非一句话木马)
php 木马的分析(加密破解)
PHP 数组入门教程小结
php 方便水印和缩略图的图形类
PHP加速 eAccelerator配置和使用指南
PHP 组件化编程技巧
IIS6+PHP5+MySQL5+Zend Optimizer+phpMyAdmin安装配置图文教程 2009年
两个强悍的php 图像处理类1
PHP 数据库 常见问题小结

PHP 中的 php.net新闻拦截!


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

  <?
//请自己修改下面变量.
$newsnum=7;
$space=20;
$width=400;
$headclass="class5";
$lowerclass="class6";
//变量设置结束.

print "<html><head><link rel=stylesheet href=dark.css></head><body>";

$opened=$QUERY_STRING;
if ($opened=="") { $opened="-1"; }

print "<table><tr><td class=class5><a target=_blank href=http://www.php.net>www.php.net</a></td></tr>";

$file=file('http://www.php.net');

$where="";
$a=0;
while ($a<count($file)) {
    $file[$a]=chop ($file[$a]);
    if ($file[$a]=="<!--http://www.php.net/-->") {
        $where=$a;
        break 1;
    }
    $a++;
}

$file=file('http://www.php.net');
$a=$where+1;
$b=0;
while ($b<$newsnum) {
      if (substr($file[$a],0,4)=="<h3>" & substr($file[$a],-6,5)=="</h3>" | substr($file[$a],0,4)=="<h3>" & substr($file[$a],-7,5)=="</h3>") {
        $from=$to;
         $to=$a;
    }

    if ($to==$a & $from!="") {
        $c=$from;
        if ($b==$opened) {
            while ($c<$to) {
                if (substr($file[$c],0,9)=="<img src=") {
                    $file[$c]="";
                }
                $file[$c]=eregi_replace("src="","src="http://www.php.net/",$file[$c]);
                $file[$c]=eregi_replace("href="","href="http://www.php.net/",$file[$c]);
                $file[$c]=eregi_replace("<h3>","</td></tr><tr><td width=$width class=$headclass><a href=$PHP_SELF?-1>",$file[$c]);
                $file[$c]=eregi_replace("</h3>","</a></td></tr><tr><td width=$width class=$lowerclass>",$file[$c]);
                print $file[$c];
                $c++;
            }
        } else {
            if (substr($file[$c],0,9)=="<img src=") {
                $file[$c]="";
            }
            $file[$c]=eregi_replace("src="","src="http://www.php.net/",$file[$c]);