Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.87 KB | None | 0 0
  1. <?php
  2.     /*BEGIN_INFO
  3.     Advanced Backlink Check, on 1st submissions of every site this will check their page for a backlink, if true = returned its all ok, if false = returned it blacklists the site without queueing the webmaster's DDLs. Also checks and blacklists free TLDs and free sub-domains, by chris ([email protected])
  4.     END_INFO*/
  5.     if(!defined("WCDDL_GUTS"))
  6.     exit;
  7.  
  8. // Config
  9. $modEnabled = true;
  10.  
  11. $subBacklink = str_replace('http://www.', 'http://', 'http://www.warezrelease.org'); // Inlude http://www in the final url.
  12.  
  13. $reason1 = "Add our linkback, then <a href='/contact.php'>email us here</a>.";
  14. $reason2 = "We dont allow free TLDs on our DDL, go buy yourself a real domain then you can submit downloads.";
  15. $reason3 = "Any type of free sub-domain or host is not allowed, go get a real host & domain, until then you cant submit. Thanks.";
  16. $reason4 = "Haha that domain don't even exist! Probably you're a spammer, sigh.";
  17. $reason9 = "No Thanks!";
  18.  
  19. $date = date("Y-m-d");
  20. $email = $_POST['email'];
  21.  
  22. $surl = $_POST['surl'];
  23. $surl = parse_url(trim($surl));
  24. $surl= str_replace("www.","",$surl['host']);
  25.  
  26.     if ($modEnabled) {
  27.  
  28.         function subBacklink($link, $useragent=false, $subBacklink) {
  29.             global $subBacklink;
  30.             $useragent = 'Googlebot/2.1 (+http://www.google.com/bot.html)';
  31.                 $ch = curl_init();
  32.                 curl_setopt($ch, CURLOPT_HEADER, 0);
  33.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  34.                 if($useragent)
  35.                     curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  36.                 curl_setopt($ch, CURLOPT_URL, $link);
  37.                 $page = curl_exec($ch);
  38.                 $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  39.         curl_close($ch);
  40.         if($httpCode == 404)
  41.             return false;
  42.  
  43.         if (preg_match('#<a[^>]+href="http://(www\.)?warezrelease\.org/?"[^>]*>#i',$page))
  44.             return true;
  45.             else
  46.             return false;
  47.         }
  48.        
  49.     function url_exists($surl) {
  50.         $resURL = curl_init();
  51.         curl_setopt($resURL, CURLOPT_URL, $surl);
  52.         curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
  53.         curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
  54.         curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
  55.         curl_exec ($resURL);
  56.  
  57.         $intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
  58.         curl_close ($resURL);
  59.  
  60.         if ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304)
  61.             return true;
  62.             else
  63.             return false;
  64.     }
  65.         function blacklistemail($email,$surl) {
  66.             global $core;
  67.            
  68.             $to  = $email; // note the comma
  69.             $from = $core->adminemail;
  70.    
  71.             $subject = 'Your website is blacklisted at WarezRelease';
  72.             $message = 'Your website is blacklisted at '.$core->siteurl.'.<br />
  73.             <br />
  74.             Domain: '.$surl.'<br />
  75.             Email: '.$email.'<br />
  76.             <br />
  77.             Possible reasons are:<br />
  78.             <br />
  79.             1. Your domain/site does not contain a valid linkback or atleast our bot can not find one.<br />
  80.             2. You may have submitted before without a backlink but since then have added one.<br />
  81.             3. Our bot can not even access your domain/site due to a mod you have installed, crappy host, free domain/host, downtime etc.
  82.             <br /><br />
  83.             In most cases you can rectify and solve the issue, then you can get un-blacklisted by either emailing us at:
  84.             [email protected] or by visiting: '.$core->siteurl.'blacklist.php and un-blacklisting yourself...
  85.             <br /><br />
  86.             Regards, <a href="'.$core->siteurl.'">'.$core->siteurl.'</a> Team.';
  87.            
  88.     //      To send HTML mail, the Content-type header must be set
  89.             $headers  = 'MIME-Version: 1.0' . "\r\n";
  90.             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  91.             $headers .= 'From: '.$from.'' . "\r\n";
  92.    
  93.             mail($to, $subject, $message, $headers);
  94.         }
  95.  
  96.         $domcheck = true;
  97.         $blacklistdomreason = '';
  98.  
  99.         $freeD = '@^(?:http:\/\/)?([^/]+)\.(co\.nr|co\.cc|tk|free)@i'; // Free domains, add more here.
  100.         $freesubD = '@^(?:http:\/\/)?([^/]+)\.(blogspot\.com|blogbus\.com|forumotion\.com|forum24\.com|mysiteproject\.com|qualtrics\.com|doattend\.com|ning\.com|eventzilla\.net|forumup\.com|page\.tl|posterous\.com|over-blog\.com|webs\.com|espacioblog\.com|pbworks\.com|mysoulspot\.com|fora\.se|healthkicker\.com|springnote\.com|renspace\.com|site11\.com|blog\.com|beep\.com|nofeehost\.com)@i'; // Free subdomains, add more here.
  101.         $nonengD = '@^(?:http:\/\/)?([^/]+)\.(fm|eu|ws|de|pk|ru|ro|pl|cz|so|it|hk|in|to|crackserver\.biz|crackdownload\.biz|co\.uk)@i'; // Non english or spammy sits, add more here.
  102.                
  103.         if (preg_match($freeD, $surl)) { $blacklistdomreason = $reason2; }
  104.        
  105.         if (preg_match($freesubD, $surl)) { $blacklistdomreason = $reason3; }
  106.        
  107.         if (preg_match($nonengD, $surl)) { $blacklistdomreason = $reason9; }
  108.    
  109.         if ($domcheck == true and $blacklistdomreason != '') {
  110.             mysql_query("INSERT INTO wcddl_blacklist (url,reason,dat,email) VALUES ('".mysql_real_escape_string($surl)."','".mysql_real_escape_string($blacklistdomreason)."','".mysql_real_escape_string($date)."','".mysql_real_escape_string($email)."')");
  111.         }
  112.        
  113.         if (subBacklink ($surl, $subBacklink) == false) {
  114.             mysql_query("INSERT INTO wcddl_blacklist (url,reason,dat,email) VALUES ('".mysql_real_escape_string($surl)."','".mysql_real_escape_string($reason1)."','".mysql_real_escape_string($date)."','".mysql_real_escape_string($email)."')");
  115.             blacklistemail($email,$surl);
  116.             mysql_query("DELETE FROM wcddl_blacklist WHERE url=''");
  117.         }
  118.        
  119.         if (url_exists($surl) == true) {
  120.             mysql_query("INSERT INTO wcddl_blacklist (url,reason,dat,email) VALUES ('".mysql_real_escape_string($surl)."','".mysql_real_escape_string($reason4)."','".mysql_real_escape_string($date)."','".mysql_real_escape_string($email)."')");
  121.         }
  122.        
  123.         mysql_query("DELETE FROM wcddl_blacklist WHERE url=''");
  124.         mysql_query("DELETE FROM wcddl_sites WHERE url=''");
  125.  
  126.     }
  127.    
  128.     $core->attachDataHook("submitChecksPass","subBacklink");
  129. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement