可以通过这种小偷程序,完成过去一些似乎完全不可能实现的任务,比如说把某个站的页面偷梁换柱后变成自己的页面,或者把某个站的一些数据(文章,图片)保存到本地数据库中加以利用。
二、下在给大家介绍一下PHP电影小偷基本编写配置文件:
1、首先我们先定义好2个重要的基本配置文件(global.php,commom.php);
(1)、其中global.php是定义所有函数的配置文件,直接把下面代码另存为global.php即可不必修改,相关函数的使用方法将在一下课给大家讲解。
<?php
$timestamp = time();
function open($file,$type=''){
global $fromurl,$referer;
$cachename=$file;
if($type){
$file=$fromurl.'/'.$type.'/'.$file;
}else{
$file=$fromurl.'/'.$file;
}
if($open=file($file)){
$count=count($open);
for($i=0;$i<$count;$i++){
$theget.=$open[$i];
}
}else{
die('<script language=javascript>document.write("<a href="+window.location+">超时,请点击这里...</a>");</script>');
}
return $theget;
}
function update($file,$type=''){
//更新cache中的文件
global $timestamp,$cachefile,$flush;
if(!file_exists("$cachefile/$file")){
if($type){
$data=open($file,$type);
}else{
$data=open($file);
}
writetofile("$cachefile/$file",$data);
}else{
$lastflesh=@filemtime("$cachefile/$file");
if($lastflesh + ($flush * 60) < $timestamp ){
if($type){
$data=open($file,$type);
}else{
$data=open($file);
}
writetofile("$cachefile/$file",$data);
}
}
}
function readfromfile($file_name) {
if($filenum=fopen($file_name,"r")){
flock($filenum,LOCK_SH);
$file_data=fread($filenum,filesize($file_name));
fclose($filenum);
return $file_data;
}else{
return false;
}
}
function writetofile($file_name,$data,$method="w") {
if($filenum=fopen($file_name,$method)){
flock($filenum,LOCK_EX);
$file_data=fwrite($filenum,$data);
fclose($filenum);
return $file_data;
}else{
return false;
}
}
function cut($file,$from,$end){
$message=explode($from,$file);
$message=explode($end,$message[1]);
return $message[0];
}
function updatecache($file,$cache=''){
global $timestamp,$flush;
if(!file_exists($file)){
writetofile($file,$cache);
$return=$cache;
}elseif(@filemtime($file) < $timestamp - ($flush * 60)){
writetofile($file,$cache);
$return=$cache;
}else{
$return=readfromfile($file);
}
return $return;
}
?>
<?php
$fromurl = "http://www.cccyy.com"; //小偷程序目标网站,后面不要带 “/”
$flush="30";//update函数中自动同步更新时间分钟
$cachefile="cache";//生成缓存目录,不要带 “/”
include './global.php';
?>
原创文章如转载,请注明:转载自 阳春一月 [ http://blog.ycjan.com/ ]
本文链接地址:http://blog.ycjan.com/php/20090530881.html