0 Members and 1 Guest are viewing this topic.
<?PHPsession_name("dnsbl");session_start();$publicKey = "<Recaptcha public key>";$privateKey = "<Recaptcha private key>";$whitelist = array();$checkIP = (isset($_GET['ip']) && isset($_GET['testblock'])?$_GET['ip']:$_SERVER['REMOTE_HOST']);$ip = explode(".",$checkIP);$dnsRequest = "$ip[3].$ip[2].$ip[1].$ip[0].dnsbl.tornevall.org";$requestResult = gethostbyname($dnsRequest);$isBlocked = ($requestResult!=$dnsRequest);if (isset($_GET['captcha'])){ $array_postvars = array(); $array_postvars[] = 'privatekey=' . $privateKey; $array_postvars[] = 'remoteip=' . $_SERVER['REMOTE_HOST']; $array_postvars[] = 'challenge=' . $_POST['recaptcha_challenge_field']; $array_postvars[] = 'response=' . $_POST['recaptcha_response_field']; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $array_postvars)); curl_setopt($ch, CURLOPT_URL, "http://www.google.com/recaptcha/api/verify"); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $error = curl_error($ch); unset($_SESSION['recaptcha']); if ($result == "true\nsuccess") $_SESSION['recaptcha'] = true; header("location: index.php");} if (($isBlocked || isset($_GET['testblock'])) && !in_array($checkIP,$whitelist) && !isset($_SESSION['recaptcha'])){ header('HTTP/1.0 403 Forbidden'); $file = file_get_contents("blocked_hosts.txt"); $file .= "\n[" . date("r") . "] Blocked: $checkIP " . ($isBlocked?"Block":"Test"); file_put_contents("blocked_hosts.txt",$file); $errorCode = explode(".",$requestResult); $errorCode = intval($errorCode[3]); echo "<html> <head> <title>Blocked</title> </head> <body> Apologies, but your IP ($checkIP) is blacklisted as a spammer. <span style=\"color:#F00\">You have not been banned from Omnimaga</span>. If you believe this is in error, please e-mail <a href=\"http://www.google.com/recaptcha/mailhide/d?k=01zMDC5OWSs7zbYNzHfWcbLg==&c=xOphTe00o_PsF0UW3DYNxgM6oLOdZ92RuAQvVkgZqQM=\" onclick=\"window.open('http://www.google.com/recaptcha/mailhide/d?k\\07501zMDC5OWSs7zbYNzHfWcbLg\\75\\75\\46c\\75xOphTe00o_PsF0UW3DYNxgM6oLOdZ92RuAQvVkgZqQM\\075', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">[email protected]</a> for help. Please remember to include your IP, $checkIP, in the message. This site is using the DNSBL provided by http://dnsbl.tornevall.org/ <br/>Code received: $errorCode<br/>Blocked for:<br/><ul>"; if ($errorCode & 1) echo "<li>Proxy has been scanned</li>"; if ($errorCode & 2) echo "<li>Proxy is working</li>"; if ($errorCode & 8) echo "<li>Proxy was tested, but timed out on connection</li>"; if ($errorCode & 16) echo "<li>Proxy was tested, but failed at connection</li>"; if ($errorCode & 32) echo "<li>Proxy was tested but the IP was different to the one connected at (Including TOR)</li>"; if ($errorCode & 64) echo "<li>IP marked as \"abusive host\". Primary target is web-form spamming (includes dnsbl_remote)</li>"; if ($errorCode & 128) echo "<li>Proxy has a different anonymous-state (web-based proxies, like anonymouse, etc)</li>"; echo "</ul><a href=\"http://dnsbl.tornevall.org/index.php?do=usage\">Please see the DNSBL for more information on the error codes</a>"; echo '<br/>You may solve the following captcha to access the site: <form action="dnsbl.php?captcha" method="POST"> <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k='.$publicKey.'"> </script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k='.$publicKey.'" height="300" width="500" frameborder="0"></iframe><br> <textarea name="recaptcha_challenge_field" rows="3" cols="40"> </textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> </form> </body></html>'; die();}if (isset($_GET['clearSession'])){ session_destroy();}?>
<?PHP include("dnsbl.php") ?>
Sweet, hopefully it helps. I've noticed there are a ton more spambots then usual these days.EDIT: I think it broke the ajax though for loading quick reply, quotes etc.