Add Captcha Me

All support enquiries for other DaddyScripts' scripts go in here...

Add Captcha Me

Postby Mimil1025 » Tue Aug 12, 2014 9:05 am

I tried to put Captcha Me with the help :
Code: Select all

Exemple complet (coté serveur & client)

    <form method="post">
    <?php
    require_once("captchme-lib.php");
     
    $publicKey = "Votre clé publique";
    $privateKey = "Votre clé privée";
    $authenKey = "Votre clé d’authentification";
     
    # Reponse des services Captchme
    $response = null;
    # Code erreur
    $error = null;
     
    if (isset($_POST["captchme_response_field"])) {
    $remoteIp = $_SERVER["REMOTE_ADDR"];
    # Controle du captcha
    $response = captchme_verify ($privateKey,
    $_POST["captchme_challenge_field"],
    $_POST["captchme_response_field"],
    $remoteIp,
    $authenKey);
     
    if ($response->is_valid) {
    echo "Valid captcha answer!";
    } else {
    $error = $response->error;
    }
    }
     
    # Affichage du captcha
    echo captchme_generate_html($publicKey, $error, $ssl, $customAttributes);
    ?>
    <div><input type="submit" value="submit"/></div>
    </form>


But I did not succesful.

The code of my index is :
Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////
//  Product: Daddy's Link Protector               
//  Version: 1.X                       
//                        
// by DaddyScripts.com                  
//                               
///////////////////////////////////////////////////////////////////////////

include ('header.php');
if($_POST['submit'] =="") {
} else {
$title = $_POST['title'];
$hebergeurs = $_POST['hebergeurs'];
$postedinfo = $_POST['information'];
$postedtitle = $_POST['title'];
$postedtitle = str_replace("'",'',"$postedtitle");
$postedtitle = str_replace("&",'',"$postedtitle");
$postedtitle = str_replace("|",'%20',"$postedtitle");
$postedtitle = stripslashes("$postedtitle");
$radiotop20 = $_POST['R1'];
$radiopass = $_POST['R2'];
$userip = $_SERVER['REMOTE_ADDR'];
$todaydate = getdate();
if($postedinfo=="" or $postedtitle =="") {
   echo "<div class=\"error\"><img src=\"./img/error.png\">Please fill in all the fields below:</div>";
} else {
   $fancyurl= rand(0,999) .$title;
   $rand2=("$fancyurl");
   $filename = "./files/".$rand2.".dlp";
if (file_exists($filename)) {
   die("An unusual error occured. Please navigate BACK using your browser and re-submit your links again.");
} else {
   $filelist = fopen("./files/".$rand2.".dlp","w");
   $fileconfig = fopen("./config/".$rand2.".dlp","w");

if($radiopass == "V3") {
   $radiopass = "Yes";
} else {
   $radiopass = "No";
}
   $time = time();
   fwrite($filelist, $_POST['information']."\n");
   fwrite($fileconfig, $time. "|" .$radiopass ."|" .md5($_POST['pass']) ."|" .$userip ."|0");
   $me=$shorturl;
   if ($me==true)
        $short= "";
   else
        $short= "index.php?ID=";

?>
<div class="success"><img src="./img/success.png">Your new URL is
  <script type="text/javascript"> function SelectAll(id) { document.getElementById(id).focus(); document.getElementById(id).select(); } </script>
  Textarea:
  <input type="text" id="txtfld" style="width:400px" onClick="SelectAll('txtfld');" value = "<? echo $scripturl .$short.$rand2;?>l" />
</div>
<?
}
}
}
if($_GET['ID']=="") {
if (isset($_POST['submit'])){
}else{
?>
<?php
}
?>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry">
<fieldset>
<p align="center">
<b>Title:</b>
<input type="title" name="title" size="20">
</p>
<p align="center">
  <label for="hebergeurs"><strong>Hebergeurs:</strong></label>
  <select name="hebergeurs" id="hebergeurs">
    <option>Oboom</option>
    <option>Turbobit</option>
    <option>Uploaded</option>
    <option>Uploadable</option>
  </select>
</p>
<p align="center">
<b>Links</b><br>
<TEXTAREA NAME="information" COLS="40" ROWS="5"></TEXTAREA><br>
<div id="email">
      <p align="center"><label><b>Password</b><br>
      </label>
      <input name="pass" type="password" size="20" />
    </div>
<p align="center">
<BR>Password Protected Links?* Yes <input onclick="javascript: $('#email').show('slow');" type="radio" name="R2" value="V3" />  No
<input onclick="javascript: $('#email').hide('slow');" type="radio" name="R2" value="V4" checked /><br>
<br>
<p align="center">
<INPUT TYPE="submit" NAME="submit" VALUE="Create Protected Links!"><BR>
</p>
</fieldset>
*If a password isn't inputted, a captcha will be displayed before showing the
links to prevent the links from being spidered.<BR>
</p>
<?
} else {
?>
<?
$IDFile = "./files/".$_GET["ID"].".dlp";
if (file_exists($IDFile)) {
$fop =  fopen("./config/".$_GET["ID"].".dlp", "r");
$content = fread($fop, '999');
fclose($fop);
$content = explode("|", $content);
if( isset($_POST['Submit0'])) {
if (in_array(md5($_POST['Pass1']), $content)) {
$passplus = "allow";
}
}
if ($content[1] == "Yes" && $passplus == "") {
if( isset($_POST['Submit0'])) {
?>
<div class="error"><img src="./img/error.png">You have entered an incorrect password. Please make sure you are authorized to view these links and try again later.</div>
<?
}else{
}
?>
</FORM><p align="center">Password Protected Link(s):<BR>
   &nbsp;</p>
<form method="POST" action="<?php echo $_SERVER['php_SELF'];?>">
   <p align="center"><input type="password" name="Pass1" size="20"></p>
   <p align="center"><input type="submit" value="Submit" name="Submit0"></p>
</form>
<p align="center"><BR><BR>
   </p>
<?
} elseif ($content[1] == "No") {
?>

<?
if( isset($_POST['submit1']) && $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) || isset($_SESSION['bypass']) && $_SESSION['bypass'] == md5("hhjjww2a")) {
$_SESSION['bypass'] = md5("hhjjww2a");
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
if (isset($_SESSION['views']) && $_SESSION['views'] == $_GET['ID']){
}else{
$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;
}
?>
<center>
<p>Hidden Links:<table width="40%" border="3">
  <tbody>
    <tr>
      <td><p align="center">
        <?php
$fop =  fopen('./files/'.$_GET['ID'].'.dlp', 'r');
$links = fread($fop, filesize('./files/'.$_GET['ID'].'.dlp'));
fclose($fop);
$links = explode("\n", $links);
$arrayNo = count($links);
$i = 0;
while ($links[$arrayNo] <> $links[$i]) {
?>
        <p align="center"><a href="<?php echo $links[$i];?>"><?php echo $links[$i];?></a></p>
        <div align="center">
          <?php
$i++;
}
?>
        </div></td>
    </tr>
  </tbody>
</table>
</center></p>
<?php
if (isset($views)){
?>
<p align="center">Views: <?php echo $views;?></p>
<?php
}else{
?>
<p align="center">Views: <?php echo $content[4];?></p>
<?
}
      unset($_SESSION['security_code']);
   } else {
if( isset($_POST['submit1'])) {
      // Insert your code for showing an error message here
   echo "<div class=\"error\"><img src=\"./img/error.png\">Sorry, you have provided an invalid security code</div>";
   }
?>
<form method="post" action="<?php echo $_SERVER['php_SELF'];?>">
      <p align="center"><?php
require_once("captchme-lib.php");
 
$publicKey = "Plublic key";
$privateKey = "Private key";
$authenKey = "Authen key";
 
# Reponse des services Captchme
$response = null;
# Code erreur
$error = null;
 
if (isset($_POST["captchme_response_field"])) {
$remoteIp = $_SERVER["REMOTE_ADDR"];
# Controle du captcha
$response = captchme_verify ($privateKey,
$_POST["captchme_challenge_field"],
$_POST["captchme_response_field"],
$remoteIp,
$authenKey);
 
if ($response->is_valid) {
echo "Valid captcha answer!";
} else {
$error = $response->error;
}
}
 
# Affichage du captcha
echo captchme_generate_html($publicKey, $error, $ssl, $customAttributes);
?>
<div><input type="submit" value="submit"/></div><br />
      <input type="submit" name="submit1" value="Submit" />
</p>
</form>
<?
}
} elseif ($passplus == "allow") {
if (isset($_SESSION['views']) && $_SESSION['views'] == $_GET['ID']){
}else{
$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;
}
?>
<center>
<p>Hidden Links:<BR>
   <?php
$fop =  fopen('./files/'.$_GET['ID'].'.dlp', 'r');
$links = fread($fop, filesize('./files/'.$_GET['ID'].'.dlp'));
fclose($fop);
$links = explode("\n", $links);
$arrayNo = count($links);
$i = 0;
while ($links[$arrayNo] <> $links[$i]) {
?>
<p><a href="<?php echo $links[$i];?>"><?php echo $links[$i];?></a></p>
<?php
$i++;
}
?>
</center></p>
<?php
if (isset($views)){
?>
<p align="center">Views: <?php echo $views;?></p>
<?php
}else{
?>
<p align="center">Views: <?php echo $content[4];?></p>
<?
}
}
} else {
echo "<div class=\"error\"><img src=\"./img/error.png\">The ID was not found, please double check your ID. However, the ID may have been deleted as per request from the uploader.</div>";
?>

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

Pouvez-vous m'aider?
Mimil1025
Newbie Member
 
Posts: 2
Joined: Mon Aug 11, 2014 7:59 pm

Re: Add Captcha Me

Postby SamEA » Sat Aug 16, 2014 1:01 pm

Did you have a look at the following post: viewtopic.php?f=9&t=696&hilit=captcha?
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Add Captcha Me

Postby Mimil1025 » Sun Aug 17, 2014 9:28 am

Yes, I have a look at the following post: viewtopic.php?f=9&t=696&hilit=captcha
But, the problem is when I click submit, that does not return me to the page protected links.
The code is :
Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////
//  Product: Daddy's Link Protector                   
//  Version: 1.X                           
//                               
// by DaddyScripts.com                       
//                                       
///////////////////////////////////////////////////////////////////////////

include ('header.php');
if($_POST['submit'] =="") {
} else {
$title = $_POST['title'];
$hebergeurs = $_POST['hebergeurs'];
$postedinfo = $_POST['information'];
$postedtitle = $_POST['title'];
$postedtitle = str_replace("'",'',"$postedtitle");
$postedtitle = str_replace("&",'',"$postedtitle");
$postedtitle = str_replace("|",'%20',"$postedtitle");
$postedtitle = stripslashes("$postedtitle");
$radiotop20 = $_POST['R1'];
$radiopass = $_POST['R2'];
$userip = $_SERVER['REMOTE_ADDR'];
$todaydate = getdate();
if($postedinfo=="" or $postedtitle =="") {
    echo "<div class=\"error\"><img src=\"./img/error.png\">Please fill in all the fields below:</div>";
} else {
    $fancyurl= rand(0,999) .$title;
    $rand2=("$fancyurl");
    $filename = "./files/".$rand2.".dlp";
if (file_exists($filename)) {
    die("An unusual error occured. Please navigate BACK using your browser and re-submit your links again.");
} else {
    $filelist = fopen("./files/".$rand2.".dlp","w");
    $fileconfig = fopen("./config/".$rand2.".dlp","w");

if($radiopass == "V3") {
    $radiopass = "Yes";
} else {
    $radiopass = "No";
}
    $time = time();
    fwrite($filelist, $_POST['information']."\n");
    fwrite($fileconfig, $time. "|" .$radiopass ."|" .md5($_POST['pass']) ."|" .$userip ."|0");
    $me=$shorturl;
    if ($me==true)
          $short= "";
    else
          $short= "index.php?ID=";

?>
<div class="success"><img src="./img/success.png">Your new URL is
  <script type="text/javascript"> function SelectAll(id) { document.getElementById(id).focus(); document.getElementById(id).select(); } </script>
  Textarea:
  <input type="text" id="txtfld" style="width:400px" onClick="SelectAll('txtfld');" value = "<? echo $scripturl .$short.$rand2;?>l" />
</div>
<?
}
}
}
if($_GET['ID']=="") {
if (isset($_POST['submit'])){
}else{
?>
<?php
}
?>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry">
<fieldset>
<p align="center">
<b>Title:</b>
<input type="title" name="title" size="20">
</p>
<p align="center">
  <label for="hebergeurs"><strong>Hebergeurs:</strong></label>
  <select name="hebergeurs" id="hebergeurs">
    <option>Oboom</option>
    <option>Turbobit</option>
    <option>Uploaded</option>
    <option>Uploadable</option>
  </select>
</p>
<p align="center">
<b>Links</b><br>
<TEXTAREA NAME="information" COLS="40" ROWS="5"></TEXTAREA><br>
<div id="email">
      <p align="center"><label><b>Password</b><br>
        </label>
      <input name="pass" type="password" size="20" />
    </div>
<p align="center">
<BR>Password Protected Links?* Yes <input onclick="javascript: $('#email').show('slow');" type="radio" name="R2" value="V3" />  No
<input onclick="javascript: $('#email').hide('slow');" type="radio" name="R2" value="V4" checked /><br>
<br>
<p align="center">
<INPUT TYPE="submit" NAME="submit" VALUE="Create Protected Links!"><BR>
</p>
</fieldset>
*If a password isn't inputted, a captcha will be displayed before showing the
links to prevent the links from being spidered.<BR>
</p>
<?
} else {
?>
<?
$IDFile = "./files/".$_GET["ID"].".dlp";
if (file_exists($IDFile)) {
$fop =  fopen("./config/".$_GET["ID"].".dlp", "r");
$content = fread($fop, '999');
fclose($fop);
$content = explode("|", $content);
if( isset($_POST['Submit0'])) {
if (in_array(md5($_POST['Pass1']), $content)) {
$passplus = "allow";
}
}
if ($content[1] == "Yes" && $passplus == "") {
if( isset($_POST['Submit0'])) {
?>
<div class="error"><img src="./img/error.png">You have entered an incorrect password. Please make sure you are authorized to view these links and try again later.</div>
<?
}else{
}
?>
</FORM><p align="center">Password Protected Link(s):<BR>
    &nbsp;</p>
<form method="POST" action="<?php echo $_SERVER['php_SELF'];?>">
    <p align="center"><input type="password" name="Pass1" size="20"></p>
    <p align="center"><input type="submit" value="Submit" name="Submit0"></p>
</form>
<p align="center"><BR><BR>
    </p>
<?
} elseif ($content[1] == "No") {
?>

<?
if( isset($_POST['submit1']) && $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) || isset($_SESSION['bypass']) && $_SESSION['bypass'] == md5("hhjjww2a")) {
$_SESSION['bypass'] = md5("hhjjww2a");
        // Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
if (isset($_SESSION['views']) && $_SESSION['views'] == $_GET['ID']){
}else{
$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;
}
?>
<center>
<p>Hidden Links:<table width="40%" border="3">
  <tbody>
    <tr>
      <td><p align="center">
        <?php
$fop =  fopen('./files/'.$_GET['ID'].'.dlp', 'r');
$links = fread($fop, filesize('./files/'.$_GET['ID'].'.dlp'));
fclose($fop);
$links = explode("\n", $links);
$arrayNo = count($links);
$i = 0;
while ($links[$arrayNo] <> $links[$i]) {
?>
        <p align="center"><a href="<?php echo $links[$i];?>"><?php echo $links[$i];?></a></p>
        <div align="center">
          <?php
$i++;
}
?>
        </div></td>
    </tr>
  </tbody>
</table>
</center></p>
<?php
if (isset($views)){
?>
<p align="center">Views: <?php echo $views;?></p>
<?php
}else{
?>
<p align="center">Views: <?php echo $content[4];?></p>
<?
}
        unset($_SESSION['security_code']);
   } else {
if( isset($_POST['submit1'])) {
        // Insert your code for showing an error message here
    echo "<div class=\"error\"><img src=\"./img/error.png\">Sorry, you have provided an invalid security code</div>";
   }
?>
<form method="POST" action="<?php echo $_SERVER['php_SELF'];?>">
        <p align="center"><?php
require_once("captchme-lib.php");
 
$publicKey = "publicKey";
$privateKey = "privateKey";
$authenKey = "authenKey";
 
# Reponse des services Captchme
$response = null;
# Code erreur
$error = null;
 
if (isset($_POST["captchme_response_field"])) {
$remoteIp = $_SERVER["REMOTE_ADDR"];
# Controle du captcha
$response = captchme_verify ($privateKey,
$_POST["captchme_challenge_field"],
$_POST["captchme_response_field"],
$remoteIp,
$authenKey);
 
if ($response->is_valid) {
echo "Valid captcha answer!";
} else {
$error = $response->error;
}
}
 
# Affichage du captcha
echo captchme_generate_html($publicKey, $error, $ssl, $customAttributes);
?>
</p>
  <div>
    <div align="center">
      <input type="submit" value="submit"/>
    </div>
  </div>
</p>
</form>
<?
}
} elseif ($passplus == "allow") {
if (isset($_SESSION['views']) && $_SESSION['views'] == $_GET['ID']){
}else{
$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;
}
?>
<center>
<p>Hidden Links:<BR>
   <?php
$fop =  fopen('./files/'.$_GET['ID'].'.dlp', 'r');
$links = fread($fop, filesize('./files/'.$_GET['ID'].'.dlp'));
fclose($fop);
$links = explode("\n", $links);
$arrayNo = count($links);
$i = 0;
while ($links[$arrayNo] <> $links[$i]) {
?>
<p><a href="<?php echo $links[$i];?>"><?php echo $links[$i];?></a></p>
<?php
$i++;
}
?>
</center></p>
<?php
if (isset($views)){
?>
<p align="center">Views: <?php echo $views;?></p>
<?php
}else{
?>
<p align="center">Views: <?php echo $content[4];?></p>
<?
}
}
} else {
echo "<div class=\"error\"><img src=\"./img/error.png\">The ID was not found, please double check your ID. However, the ID may have been deleted as per request from the uploader.</div>";
?>

   
<?
}
}
include ('footer.php');
?>
Mimil1025
Newbie Member
 
Posts: 2
Joined: Mon Aug 11, 2014 7:59 pm


Return to Other DS Scripts!

Who is online

Users browsing this forum: No registered users and 2 guests

cron