Page 1 of 1

Link Protector - ReCaptcha

PostPosted: Sun Apr 21, 2013 7:29 pm
by gr0g
Would it be possible to add recaptcha to the link protector script instead of the current captcha? The main reason for this is that recaptcha has audio capability which is great for the visually impaired. This is by far the best link protector script ive found however without this im not sure if i can use it for my website. Im currently looking into adding this myself but this isnt going anywhere, as im no expert on php, if you can help in anyway that would be really great :)

Re: Link Protector - ReCaptcha

PostPosted: Mon Apr 22, 2013 2:29 am
by SamEA
Hello,

I advise you look at reCaptcha documentation on how to implement it and remove/replacing it with the current captcha in ./index.php by looking at the captcha used in DLP: http://www.white-hat-web-design.co.uk/b ... ty-images/.

Re: Link Protector - ReCaptcha

PostPosted: Mon Apr 22, 2013 6:17 pm
by gr0g
Hi,

Thanks for the link, i was able to add the captcha on the index page, this is working fine now however when the captcha is entered correctly it loads up a new page (links.php) which gives the following error:

Warning: file_get_contents(./files/.dlp): failed to open stream: No such file or directory in /var/www/localhost/links.php on line 27


After the captcha is verified the links should be displayed but this isnt working, below is a copy of the code from links.php which a successfully submitted captcha links to:

Code: Select all
<?php
include('header.php');
  require_once('recaptchalib.php');
  $privatekey = "xxxxxxxxx";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");


} else {
//Your code here to handle a successful captcha.

   $fileconfig = fopen("./config/".$_GET['ID'].".dlp","w");
   fwrite($fileconfig, $content[0]. "|" .$content[1] ."|" .$content[2] ."|" .$content[3] ."|" .($content[4] + 1));
   fclose($fileconfig);
   $_SESSION['views'] = $_GET['ID'];
   $views = $content[4] + 1;
   }
   ?>
   </FORM><p align="center">Hidden Links:<BR>
   <?php $fetch = file_get_contents("./files/".$_GET["ID"].".dlp"); echo $fetch; ?><BR><BR>
   </p>

<?php
include('./footer.php');
?>


Can you provide any advice?

Re: Link Protector - ReCaptcha

PostPosted: Mon Apr 22, 2013 11:03 pm
by SamEA
Can you please provide the link to where DLP is located in order for further investigation.

Re: Link Protector - ReCaptcha

PostPosted: Tue Apr 23, 2013 9:12 am
by gr0g
The testing url is as follows:

Code: Select all
http://linkz.uni.me


This domain has just been setup so it might take some time to propagate if its not resolving for you. Ive been testing this script on my local pc.

Re: Link Protector - ReCaptcha

PostPosted: Thu May 02, 2013 3:52 pm
by SamEA
Thank you for verifying your URL.

Try replacing:
Code: Select all
<form method="post" action="links.php">


or

Code: Select all
<form method="post" action="<?php echo $_SERVER['php_SELF'];?>">


with

Code: Select all
<form method="post" action="links.php?ID=<?php echo $_GET['ID'];?>">


The reason why you are receiving the above error, is most probably due to the GET ID parameter not being passed after the CAPTCHA form is submitted (POSTed).

Re: Link Protector - ReCaptcha

PostPosted: Tue May 07, 2013 3:16 pm
by gr0g
Ive used the following code as advised and it now works perfectly:

Code: Select all
<form method="post" action="links.php?ID=<?php echo $_GET['ID'];?>">


Thanks for your help with this! :)

Re: Link Protector - ReCaptcha

PostPosted: Tue May 07, 2013 4:23 pm
by gr0g
I have just been testing this now and it is working perfectly however the only thing missing is the links which are displayed after a successful captcha are no longer clickable. The code from the following thread makes links clickable, this part must have been left out of the links.php page as its not working.
Code: Select all
http://forum.daddyscripts.com/viewtopic.php?f=34&t=317p


Can you advise? The contents of the links.php page is contained in my post above. (Apologies for double post, i dont seem to be able to edit my previous one)