collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 34
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • Skaty: [link]
    May 21, 2013, 02:54:27 PM
  • Skaty: tooltip in sp block
    May 21, 2013, 02:54:20 PM
  • Tattoocu_CarteL: neden adres yazınca link diye çikiyor direk adres çiksa olmaz mı
    May 19, 2013, 11:54:41 AM
  • Tattoocu_CarteL: [link]
    May 19, 2013, 11:54:26 AM
  • Old Fossil: Hey Nathaniel
    May 16, 2013, 09:41:05 AM
  • Nathaniel: lurk
    May 16, 2013, 03:19:14 AM
  • omidmavi1986: :'(
    May 15, 2013, 05:51:48 AM
  • DeToX: very nice simple mod's like!
    May 09, 2013, 01:32:03 PM
  • dhayzon: ;D
    May 09, 2013, 12:38:23 PM
  • dhayzon: xd
    May 09, 2013, 12:38:19 PM
  • dhayzon: hola y les hablo en español me gusta mucho el portal
    May 09, 2013, 12:38:12 PM
  • la muerte: If only I'd know how to fix it :D
    May 06, 2013, 11:24:15 AM
  • la muerte: I might have found the reason many sites have issues with shoutbox refresh looping on post etc [link]
    May 06, 2013, 11:23:57 AM
  • apo: elinize saglik beyler
    May 03, 2013, 02:08:40 PM
  • [SiNaN]: Well, you can't do much about it. I'm sure everyone is trying their best but it's not easy. At least old solved topics may provide a clue for those having similar problems I hope.
    May 02, 2013, 11:33:00 AM
  • JohnS: Wow! visited site earlier and 3 users online - that must be a record lately. I ca't see point of support pages here as number of posts with zero replies is big!
    May 02, 2013, 08:46:34 AM
  • rocknroller: what is up
    April 30, 2013, 02:06:06 PM
  • rocknroller: hey
    April 30, 2013, 02:05:53 PM
  • dhayzon: Shoutbox in an iframe is possible
    April 27, 2013, 11:00:14 AM

* Team Blog

* Recent Posts

Re: Only certain topics by DeToX
[Yesterday at 07:34:38 AM]


Re: Custom Message Block by Hoodie
[May 23, 2013, 01:39:56 PM]


Re: Roster by Hoodie
[May 23, 2013, 12:36:47 PM]


¿como agrego un chat a mi foro? by cachencho29
[May 23, 2013, 10:28:23 AM]


¿como agrego un contador de visitas? by cachencho29
[May 23, 2013, 10:25:24 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: add adscaptcha in bloks or pages  (Read 887 times)

0 Members and 1 Guest are viewing this topic.

Offline iulyz

  • Newbie
  • Posts: 4
add adscaptcha in bloks or pages
« on: December 21, 2011, 05:28:09 PM »
How do i make this code work in a block or page?
I try to add this code via php custom block but do not working... appear only button from form.
Can some one help me with this please. :'(

Code: [Select]
$ADSCAPTCHA_API = 'api.adscaptcha.com';

function GetCaptcha($captchaId, $publicKey) {
global $ADSCAPTCHA_API;

$dummy = rand(1, 9999999999);
$urlGet = 'http://' . $ADSCAPTCHA_API . "/Get.aspx";
$urlNoScript = 'http://' . $ADSCAPTCHA_API . "/NoScript.aspx";
$params = "?CaptchaId="  . $captchaId .
  "&PublicKey=" . $publicKey .
  "&Dummy=" . $dummy;

$result  = "<script src='" . $urlGet . $params . "' type='text/javascript'></script>\n";
$result .= "<noscript>\n";
$result .= "\t<iframe src='" . $urlNoScript . $params . "' width='300' height='100' frameborder='0'></iframe>\n";
$result .= "\t<table>\n";
$result .= "\t<tr><td>Type challenge here:</td><td><input type='text' name='adscaptcha_response_field' value='' /></td></tr>\n";
$result .= "\t<tr><td>Paste code here:</td><td><input type='text' name='adscaptcha_challenge_field' value='' /></td></tr>\n";
$result .= "\t</table>\n";
$result .= "</noscript>\n";

return $result;
}

function ValidateCaptcha($captchaId, $privateKey, $challengeValue, $responseValue, $remoteAddress) {
global $ADSCAPTCHA_API;

$host = $ADSCAPTCHA_API;
$path = "/Validate.aspx";

$params = "CaptchaId=" . $captchaId . "&PrivateKey=" . $privateKey . "&ChallengeCode=" . $challengeValue . "&UserResponse=" . $responseValue . "&RemoteAddress=" . $remoteAddress;

$result = HttpPost($host, $path, $params);

return $result;
}

function FixEncoding($str) {
$curr_encoding = mb_detect_encoding($str) ;

if($curr_encoding == "UTF-8" && mb_check_encoding($str,"UTF-8")) {
return $str;
} else {
return utf8_encode($str);
}
}

function HttpPost($host, $path, $data, $port = 80) {
$data = FixEncoding($data);

$http_request  = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$http_request .= "Content-Length: " . strlen($data) . "\r\n";
$http_request .= "\r\n";
$http_request .= $data;

$response = '';
if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) == false) {
die ('Could not open socket! ' . $errstr);
}

fwrite($fs, $http_request);

while (!feof($fs))
$response .= fgets($fs, 1160);
fclose($fs);

$response = explode("\r\n\r\n", $response, 2);
return $response[1];
}


echo '<form action="" method="post">';

$captchaId  = '';   // Set your captcha id here
$publicKey  = '';   // Set your public key here
$privateKey = '';   // Set your private key here
$challengeValue = $_POST['adscaptcha_challenge_field'];
$responseValue  = $_POST['adscaptcha_response_field'];
$remoteAddress  = $_SERVER["REMOTE_ADDR"];

if ($challengeValue == null) {
echo GetCaptcha($captchaId, $publicKey);

echo '<input type="submit" id="submit" name="submit" />';

} else {
if (ValidateCaptcha($captchaId, $privateKey, $challengeValue, $responseValue, $remoteAddress) == "true")
{
echo "Correct :)";
// Corrent answer, continue with your submission process
} else {
echo "Wrong :(";
// Wrong answer, you may display a new AdsCaptcha and add an error message
}
}

echo '</form>';