+ -
当前位置:首页 → 问答吧 → 一个小偷程序的问题大家帮看看

一个小偷程序的问题大家帮看看

时间:2010-09-16

来源:互联网

我是一个PHP最菜的菜鸟,一点不懂也想学学谢谢支持

<?php
include_once(dirname(__FILE__).'/common.inc.php');
$http_host=strtolower($_SERVER['HTTP_HOST']);
$request_url=$_SERVER['REQUEST_URI'];

//上面代码是不是获取页面地址的?


$url='http://'.$domain.$request_url;   //这里设置变量吧
$url=replaceURL($url,'unreplace');   //




//---------------------------------------------------------------------------------------
if (!empty($_POST)) {
 $http->post($url,$_POST);
 $html=$http->body();
} else {
 if ($cachetime>0) {
  if (!$html=$cache->get($url)) {
   $html=$http->html($url);
   $cache->save($html);
  }
 } else {
  $html=$http->html($url);
 }  
}
//if (strpos($html,'0.31')!==false) { file_put_contents('g:/a.txt',$url); }
//---------这一段开始是什么作用呢?是不是只获取.html结束的地址?htm结束的可以吗或都.html?lpig=lolg像这样的可以吗



$html=common_replace($html);
if ($request_url=='/') {
 include(ROOT.'/_index.php');
} elseif (preg_match('|/\d+-\d+-\d+\.html$|i',$request_url)) {
 include(ROOT.'/_list.php');
} elseif (preg_match('|/\d+\.html$|i',$request_url)) {
 include(ROOT.'/_page.php');
}
echo $html;

[ 此帖被qq19836718在2010-09-16 14:46重新编辑 ]

作者: qq19836718   发布时间: 2010-09-16

common.inc.php里面的源码如下



<?php
error_reporting(E_ALL &~ E_NOTICE);
ob_implicit_flush();
//@set_time_limit(300);
//session_start();
//header('Content-Type: text/html; charset=utf-8');

define('ROOT',dirname(__FILE__));

include_once(ROOT.'/config.php');

set_include_path(ROOT.'/PEAR');
include_once('HTTP/myClient.php');

$http = new myHttpClient();
$httpHeader = array(
    'Referer' => 'http://ask.39.net/',
    'Accept-Language' => 'zh-cn',
    'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
    //'Accept-Encoding'    =>    'gzip, deflate',
);
$http->setDefaultHeader($httpHeader);
$http->setMaxRedirects(0);
$http->autoReferer=false;

include(ROOT.'/cache.class.php');
$options=array(
    'cacheDir'    =>    ROOT.'/cache',
    'lifeTime'    =>    3600*$cachetime,
//    'dirLevels'    =>    $cacheDirLevels,
);
$cache=new Cache($options);


////////////////////////////////////
function pp($v,$d=null)
{
    echo '<pre>';
    print_r($v);
    echo '</pre>';
    $d ? die : null;
}

function regMatch($str, $regStr, $striphtml=true)
{
    if (preg_match($regStr, $str, $result)) {
        if (isset($result[1])) {
            $r= trim($result[1]);
        } else {
            $r= trim($result[0]);
        }
        $rr= $striphtml ? strip_tags($r) : $r;
        return trim($r);
    } else {
        return null;
    }
}

作者: qq19836718   发布时间: 2010-09-16

相关阅读 更多

热门下载

更多