Advertisement
Guest User

Linkchecker

a guest
May 8th, 2015
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.59 KB | None | 0 0
  1. <?php
  2. #set_time_limit(0);
  3.  
  4. define('MAX_LINKS', 250);
  5.  
  6. $sites = array
  7.     (
  8.         '2shared.com' => 'File size',
  9.         '4shared.com' => 'fileName',
  10.         'hellshare.sk' => 'Stiahnuť súbor »',
  11.         'hellshare.com' => 'Download »',
  12.         'hellshare.cz' => 'Stáhnout soubor »',
  13.         'hellshare.pl' => 'Ściągnij plik »',
  14.         'stiahnito.sk' => 'Stiahnúť súbor',
  15.         'jumbofiles.org' => 'Download File',
  16.         'secureupload.eu' => 'Downloading ',
  17.         'megaupload.com' => 'Filename:',
  18.         'rapidgator.net' => 'Downloading:',
  19.         #'cobrashare.sk' => 'download.gif', #NEFUNGUJE! Kvoli presmerovaniu
  20.        'czshare.com' => 'Stáhnout free',
  21.         'megarotic.com' => 'Filename:',
  22.         'oron.com' => 'Download file',
  23.         'uloz.to' => 'Stáhnout',
  24.         'ulozto.sk' => 'Stáhnout',
  25.         'ulozto.cz' => 'Stáhnout',
  26.         'ulozto.net' => 'Stáhnout',
  27.         'ziddu.com' => 'File Size',
  28.         'zippyshare.com' => 'You have requested',
  29.         'warserver.cz' => 'Zobrazit link',
  30.         #'uploadstation.com' => '', DOKONCIT!
  31.        'uploaded.net' => 'Download file:', #ASI funguje
  32.        'ul.to' => 'Download file', #je to uploaded.net
  33.        #'upnito.sk' => 'stiahnuť súbor', #NEFUNGUJE!
  34.        'depositfiles.com' => 'File size:',
  35.         'filefactory.com' => 'file uploaded',
  36.         'freakshare.com' => '"Download"',
  37.         'bitshare.com' => '<h1>Downloading',
  38.         'share-online.biz' => 'download package',
  39.         'edisk.cz' => 'Naposledy stáhnutý:',
  40.         'turbobit.net' => 'class="download-file"',
  41.         'filedropper.com' => 'File Details:',
  42.         'euroshare.eu' => 'STIAHNUŤ',
  43.         'leteckaposta.cz' => 'iframe',
  44.         'mysharegadget.com' => 'File uploaded',
  45.         'fastshare.cz' => 'Nahráno dne:',
  46.         'luckyshare.net' => 'Filesize:',
  47.         'mediafire.com' => 'download.ico',
  48.         #'hotfile.com' => 'Downloading:', #NEFUNGUJE
  49.        #'lumfile.com' => '', #NIE JE NA ZAKLADE COHO HODNOTIT
  50.        #'rapidshare.com' => 'FILE DOWNLOAD', #NEFUNGUJE
  51.        'rapidshare.de' => 'Choose download-type',
  52.         'ryushare.com' => 'You have requested ',
  53.         'sendspace.com' => '>File Size:',
  54.         'hotfile.com' => 'arrow_down',
  55.         'crocko.com' => 'Download:',
  56.         'easy-share.com' => 'Download:', #JE TO CROCKO.COM
  57.        'badongo.com' => 'DOWNLOAD THIS FILE', #UZ NEEXISTUJE, VLOZENY LEN FORMALNE
  58.        'filejungle.com' => 'You can only',
  59.         'fileserve.com' => 'please login to download',
  60.         'filesonic.com' => 'DOWNLOAD THIS', #UZ NEEXISTUJE
  61.        'stahovadlo.cz' => '<dt>Velikost:',
  62.         #'dataport.cz' => 'Popis souboru', #NEFUNGUJE, Kvoli presmerovaniu
  63.        #'share-rapid.com' => 'souborinfo',
  64.        #'share-rapid.biz' => 'souborinfo',
  65.        #'sharerapid.biz' => 'souborinfo',
  66.        #'share-rapid.cz' => 'souborinfo',
  67.        #'sharerapid.cz' => 'souborinfo',
  68.        #'megashares.com' => 'Filename',
  69.        #'netload.in' => 'dl_first_tacho.gif', #NEFUNGUJE
  70.        'uploading.com' => 'Download for free',
  71.         'storage.to' => 'Downloading:', #UZ NEEXISTUJE
  72.        'uploadbox.com' => 'Free Download', #UZ NEEXISTUJE
  73.        'zshare.net' => 'File Name', #UZ NEEXISTUJE
  74.        'x7.to' => 'File DOWNLOAD', #UZ NEEXISTUJE
  75.        'duckload.com' => 'File DOWNLOAD', #UZ NEEXISTUJE
  76.        'webshare.cz' => 'finder-sprite-detail.png'
  77.                
  78.     );
  79. ?>
  80. <!doctype html>
  81. <html>
  82. <head>
  83. <title>Link checker</title>
  84. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  85.  
  86. <style type="text/css">
  87. <!--
  88. * {margin:0; padding:0;}
  89. #main {position:relative; margin:auto; padding:20px; width:800px; height:auto;}
  90. #hostingy {padding:15px 0px 30px 0px; font-size:11px;}
  91. body {font:13px verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif;}
  92.  
  93. .tlacitko {padding:10px; font-weight:bold;}
  94.  
  95. .green {background:#ccffcc; color:#006600; padding:1px 0 2px 0;}
  96. a.green {color:#006600; text-decoration:none;}
  97. a.green:hover {color:#006600; text-decoration:underline;}
  98. a.green:active {color:#006600;}
  99. a.green:visited {color:#006600;}
  100.  
  101. .red {background:#ffcccc; color:#990000; padding:1px 0 2px 0;}
  102. a.red {color:#990000; text-decoration:none;}
  103. a.red:hover {color:#990000; text-decoration:underline;}
  104. a.red:active {color:#990000;}
  105. a.red:visited {color:#990000;}
  106. -->
  107. </style>
  108. </head><body>
  109. <div id="main">
  110. <strong>Podporované hostingy / Supported hosts</strong><br />
  111. <div id="hostingy">
  112. <?php
  113. #Pôvodná verzia, vypisovanie do tabuľky.
  114. #$es = 0;
  115. #echo '<table cellspacing="2" cellpadding="2"><tr>';
  116. #foreach ($sites as $site => $match){
  117. #    echo '<td>'.$site.'</td>';
  118. #    ++$es;
  119. #    echo ($es%5) ? '' : '</tr><tr>';
  120. #}
  121. #echo '</tr></table>';
  122.  
  123. $es = 0;
  124. foreach ($sites as $site => $match){
  125.     echo ''.$site.' <strong>|</strong> ';
  126.     ++$es;
  127.     echo ($es%5) ? '' : '';
  128. }
  129. ?>
  130. </div>
  131. <form action="" method="post">
  132.     <b>Vložte odkazy / Insert links: (maximálně 250 odkazů / max 250 at once)</b><br />
  133.     <textarea rows="15" cols="100" name="links" class="textarea"></textarea><br />
  134.     <br />
  135.     <input class="tlacitko" type="submit" value="Zkontrolovat / Check" name="checklinks" class="button" /><!--<input type="reset" value="Clear" class="button">-->
  136. </form>
  137. <br />
  138. <br />
  139.  
  140. <?php
  141. function getPage($url){
  142.     if(function_exists('curl_init')) {
  143.         $ch = curl_init($url);
  144.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  145.         curl_setopt($ch, CURLOPT_MAXREDIRS,10);
  146. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);        
  147.         $page = curl_exec($ch);
  148.         curl_close ($ch);
  149.         return $page;
  150.     }
  151.     return file_get_contents($url);
  152. }
  153.  
  154. if($_POST){
  155.  
  156.     $links = explode("\n", implode("\n", explode(" ", $_POST['links'])));
  157.     $checked = 0;
  158.     $alive = 0;
  159.  
  160.     foreach($links as $link){
  161.        $link = trim($link);
  162.        
  163.         foreach($sites as $site => $match){
  164.             if(stristr($link,$site)){
  165.                 $page = getPage($link);
  166.                 $link = htmlentities($link);
  167.                 if(stristr($page,$match)) {
  168.                     echo '<span class="green"><a class="green" href="'.$link.'"><strong>'.$link.'</strong></a></span><br />';
  169.                     $alive++;
  170.                 } else echo '<span class="red"><a class="red" href="'.$link.'"><strong>'.$link.'</strong></a></span><br />';            
  171.                
  172.                 $checked++;
  173.             }
  174.                
  175.             if($checked >= MAX_LINKS){
  176.                 echo '<br />MMaximální počet odkazů: ('.MAX_LINKS.') byl dosažený.</body></html>';
  177.                 break 2;
  178.             }
  179.         }
  180.     }
  181.     #echo ($checked == 0) ? '<span class="red">Žádný z linků není podporovaný.</span><br />' : '<br />'.$checked.' odkaz'.(($checked == 1) ? '' : 'ov').' zkontrolovaných. ('.round($alive/$checked*100).'% funkčných.)<br />';
  182.    echo ($checked == 0) ? '<span class="red">Žádný z linků není podporovaný. / No link is supported.  :-(</span><br />' : '<br />'.$checked.' odkaz'.(($checked == 1) ? '' : 'ov').' zkontrolovaný'.(($checked == 1) ? '' : 'ch').'. ('.round($alive/$checked*100).'% funkčních / works)<br />';
  183. }
  184. ?>
  185.  
  186. <?php
  187. #ZAPIS POCTU LINKOV DO SUBORU
  188. $myFile = "w8document.php";
  189. $pocet = file_get_contents($myFile);
  190. $sucet = $pocet + $checked;
  191. $fh = fopen($myFile, 'w') or die("Zápis sa nepodařil. :-(");
  192. fwrite($fh, $sucet);
  193. fclose($fh);
  194. ?>
  195. <br /><br />
  196. <?php
  197. $subor = "w8document.php";
  198. $cislo = file_get_contents($subor);
  199. $naformatovane = number_format($cislo);
  200. ?>
  201. Linkchecker už zkontroloval <?php echo $naformatovane; ?> odkazů.
  202. </div>
  203. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement