Advertisement
Guest User

Untitled

a guest
Jul 21st, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.83 KB | None | 0 0
  1. <html>
  2. <script type="text/javascript" src="./slil/highslide/highslide.js"></script>
  3. <link rel="stylesheet" type="text/css" href="./slil/highslide/highslide.css" />
  4. <script type="text/javascript">
  5.     hs.graphicsDir = './slil/highslide/graphics/';
  6.     hs.outlineType = 'outer-glow';
  7.     hs.wrapperClassName = 'outer-glow';
  8.     function t(d)
  9.     {
  10.         document.getElementById(d).style.display = (document.getElementById(d).style.display == 'none')?('inline-table'):('none');
  11.     }
  12. </script>
  13. <style>
  14. body
  15. {
  16.     font-family: verdana;
  17.     background-image:url(./plain.png);
  18.     background-attachment: fixed;
  19. }
  20. .extup
  21. {
  22.     font-family: Tahoma;
  23.     color:white;
  24.     border:1px solid black;
  25.     padding:4px;
  26.     background-color:#262308;
  27.     font-size:14pt;
  28.     width:100%;
  29.     margin-top:10px;
  30. }
  31. .extup:hover
  32. {
  33.     color:orange;
  34.     cursor:pointer;
  35. }
  36. .lighty
  37. {
  38.     background-color:#1E1E1E;
  39. }
  40. .darky
  41. {
  42.     background-color:#333333;
  43. }
  44. a
  45. {
  46.     text-decoration:none;
  47. }
  48. td
  49. {
  50.     font-family:verdana;
  51.     font-size:10pt;
  52.     color:orange;
  53. }
  54. tr:hover
  55. {
  56.     border:1px solid orange;
  57.     background-color:black;
  58. }
  59. table
  60. {
  61.     border:1px solid black;
  62. }
  63. input
  64. {
  65.     border:1px solid black;
  66.     padding:4px;
  67.     background-color:#333333;
  68.     color:orange;
  69.     font-size:10pt;
  70.     font-family:verdana;
  71. }
  72. </style>
  73. <form action="" method="post">
  74. <table width="100%" cellspacing="0" cellpadding="6" border="0">
  75.     <tr>
  76.         <td>
  77.             From: <input type="text" name="slilfrom" value="<?php if(isset($_POST['slilfrom'])){echo(stripslashes(htmlspecialchars($_POST['slilfrom'])));} ?>">
  78.         </td>
  79.        
  80.         <td>
  81.             To: <input type="text" name="slilto" value="<?php if(isset($_POST['slilto'])){echo(stripslashes(htmlspecialchars($_POST['slilto'])));} ?>">
  82.         </td>
  83.        
  84.         <td>
  85.             Extensions (;): <input type="text" name="slilext" value="<?php if(isset($_POST['slilext'])){echo(stripslashes(htmlspecialchars($_POST['slilext'])));} ?>">
  86.         </td>
  87.        
  88.         <td>
  89.             Text (;): <input type="text" name="sliltxt" value="<?php if(isset($_POST['sliltxt'])){echo(stripslashes(htmlspecialchars($_POST['sliltxt'])));} ?>">
  90.         </td>
  91.        
  92.         <td>
  93.             <input type="submit" value="Parse">
  94.         </td>
  95.     </tr>
  96. </table>
  97. </form>
  98. <?php
  99.    
  100.     $uas = array(
  101.     //Chrome
  102.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13",
  103.     "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.9 Safari/532.9",
  104.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.1 (KHTML, like Gecko) Chrome/6.0.437.3 Safari/534.1",
  105.     //IE
  106.     "Mozilla/4.0 (compatible; MSIE 6.0; MSN 2.5; Windows 98)",
  107.     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  108.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)",
  109.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022)",
  110.     //Opera
  111.     "Opera/9.02 (Windows NT 5.1; U; en)",
  112.     "Opera/10.00 (Windows NT 6.0; U; en) Presto/2.2.0",
  113.     "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.5.24 Version/10.52"
  114.     );
  115.    
  116.     $head = array(
  117.         'Host: slil.ru',
  118.         'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
  119.         'Accept-Language: en-us,en;q=0.5',
  120.         'Accept-Encoding: gzip,deflate',
  121.         'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  122.         'Keep-Alive: 300',
  123.         'Connection: keep-alive'
  124.     );
  125.    
  126.     $exts = array();
  127.     foreach (explode(';', $_POST['slilext']) as $ext)
  128.     {
  129.         $ext = trim(mb_strtolower($ext));
  130.         if ($ext != '')
  131.         {
  132.             $exts[] = $ext;
  133.         }
  134.     }
  135.    
  136.     $exts = array_unique($exts);
  137.    
  138.     $texts = array();
  139.     foreach (explode(';', $_POST['sliltxt']) as $txt)
  140.     {
  141.         $txt = trim(mb_strtolower($txt));
  142.         if ($txt != '')
  143.         {
  144.             $texts[] = $txt;
  145.         }
  146.     }
  147.    
  148.     $texts = array_unique($texts);
  149.    
  150.     function genLinks($from, $to)
  151.     {
  152.         $i = 0; $links = array();
  153.         for ($i = 0; $i <= ($to - $from); $i++)
  154.         {
  155.             $links[] = 'http://slil.ru/'.($from+$i);
  156.         }
  157.         return $links;
  158.     }
  159.    
  160.     function parseLinks($links)
  161.     {
  162.         global $uas, $head, $exts, $texts;
  163.  
  164.         $multi_thread = curl_multi_init();
  165.         $threads = array();
  166.         $results = array();
  167.        
  168.         $i = 0;
  169.         for ($i = 0; $i < count($links); $i++)
  170.         {
  171.             $threads[$i] = curl_init();
  172.            
  173.             curl_setopt($threads[$i], CURLOPT_URL,              $links[$i]);
  174.             curl_setopt($threads[$i], CURLOPT_USERAGENT,        $uas[rand(0, count($uas)-1)]);
  175.             curl_setopt($threads[$i], CURLOPT_RETURNTRANSFER,   true);
  176.             curl_setopt($threads[$i], CURLOPT_HTTPHEADER,       $head);
  177.             curl_setopt($threads[$i], CURLOPT_ENCODING,         'gzip,deflate');
  178.            
  179.             curl_multi_add_handle($multi_thread, $threads[$i]);
  180.         }
  181.        
  182.         $start_check = null; do { curl_multi_exec($multi_thread, $start_check); } while ($start_check > 0);
  183.        
  184.         $i = 0;
  185.         for ($i = 0; $i < count($links); $i++)
  186.         {
  187.             $cResult = curl_multi_getcontent($threads[$i]);
  188.            
  189.             $filedata = explode('<p align="center">', $cResult);
  190.             $filedata = explode('</p>', $filedata[1]);
  191.             list($filename, $filesize) = explode('&nbsp;&nbsp;&nbsp;', trim(strip_tags($filedata[0])));
  192.             $id = explode('/', $links[$i]); $id = $id[count($id)-1];
  193.            
  194.             $temp_link = explode('var l1nk=\'', $cResult);
  195.             $temp_link = explode('\';', $temp_link[1]);
  196.             $temp_link = trim(str_replace("'+'", '', $temp_link[0]));
  197.            
  198.             $fext = explode('.', $filename);
  199.             $fext = mb_strtolower(trim($fext[count($fext)-1]));
  200.            
  201.             if (count($exts) > 0)
  202.             {
  203.                 if (!in_array($fext, $exts))
  204.                 {
  205.                     continue;
  206.                 }
  207.             }
  208.            
  209.            
  210.             $text_found = false;
  211.             if (count($texts) > 0)
  212.             {
  213.                 foreach ($texts as $text)
  214.                 {
  215.                     if (strstr($filename, $text))
  216.                     {
  217.                         $text_found = true; break;
  218.                     }
  219.                 }
  220.             }
  221.             else
  222.             {
  223.                 $text_found = true;
  224.             }
  225.            
  226.             if (!$text_found){continue;}
  227.            
  228.             $results[$fext][] = array('id' => $id, 'name' => $filename, 'size' => $filesize, 'link' => $temp_link);
  229.         }
  230.        
  231.         curl_multi_close($multi_thread);
  232.         return $results;
  233.     }
  234.    
  235.     if (isset($_POST['slilfrom']))
  236.     {
  237.         if (($_POST['slilto'] - $_POST['slilfrom']) > 100)
  238.         {
  239.             echo('<span style="color:white;">Too big range! Maximal range is 100.</span><hr noshade></html>'); exit;
  240.         }
  241.         $parsed = parseLinks(genLinks($_POST['slilfrom'],$_POST['slilto']));
  242.         echo('<hr noshade>');
  243.         echo('<h2 class="extup" style="color:red;">Files not found: '.count($parsed['']).'</h2>');
  244.         foreach ($parsed as $ext => $p)
  245.         {
  246.             if ($ext == '') {continue;}
  247.             $tr_color = true;
  248.             echo('<button class="extup" onClick="t(\''.$ext.'\');">*.'.mb_strtoupper($ext)." files (".count($p)."):</button>");
  249.             echo('<table width="100%" cellspacing="0" cellpadding="6" border="0" id="'.$ext.'" style="display:none;">');
  250.             foreach ($p as $pf)
  251.             {
  252.                 $tr_color = ($tr_color)?(false):(true);
  253.                 $tr_class = ($tr_color)?('lighty'):('darky');
  254.                
  255.                 $bytes = str_replace(str_split('0123456789.', 1), '', $pf['size']);
  256.                 $pf['size'] = round(str_replace($bytes, '', $pf['size'])).' '.$bytes;
  257.                
  258.                 if (in_array($ext, array('jpg', 'jpeg', 'bmp', 'gif', 'png')))
  259.                 {
  260.                     $preview = '
  261.                         <td width="20" height="20">
  262.                         <a href="http://slil.ru/'.$pf['link'].'" onClick="return hs.expand(this);">
  263.                                 <img src="./preview.png" border="0" align="absmiddle">
  264.                             </a>
  265.                         </td>
  266.                     ';
  267.                 } else {$preview = '';}
  268.                
  269.                
  270.                 echo('<tr class="'.$tr_class.'">');
  271.                 echo('
  272.                     <td width="20" height="20">
  273.                         <a href="http://slil.ru/'.$pf['link'].'">
  274.                             <img src="./download.png" border="0" align="absmiddle"></td>
  275.                         </a>
  276.                     <td width="20" height="20">
  277.                         <a href="http://slil.ru/'.$pf['id'].'" target="_blank">
  278.                             <img src="./forward.png" border="0" align="absmiddle">
  279.                         </a>
  280.                     </td>
  281.                     '.$preview.'
  282.                     <td width="100" align="right">'.$pf['size'].'</td>
  283.                     <td style="border-left:1px solid black;">'.$pf['name'].'</td>
  284.                     <td width="100" align="right">'.$pf['id'].'</td>
  285.                 ');
  286.                 echo('</tr>');
  287.             }
  288.             echo('</table><br>');
  289.         }
  290.        
  291.     }
  292. ?>
  293. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement