hello peeps,
I have found this excellent php captcha class at:

http://www.ejeliot.com/pages/2

it works a treat up to a point. posting data across a form and it works wonderfully, but what I am having trouble with is posting the the contents of my mail form to the formmail-clone.cgi script on my website.

My mail form action is to a formmail-clone.cgi script and as a result the phpcaptcha cannot be verified as it would against the supplied form.php example.

Is there a way to verify the captcha before the mail is sent to the cgi script?
This has been boiling my swede for the last three days. If someone could point me in the right direction, they would become my most recent hero.

    Thanks for your reply, but I think you have misunderstood my question. I have a perfectly good captcha class that works, if using php to pass data between php scripts.

    What I cannot do, is use the captcha class when sending form data to my web address. My web host mail system is based on formmail-clone.cgi and what I want to do is verify or reject the form data before it gets to the cgi script.

    But thank you all the same 😮)

      My apologies for misunderstanding your question.

      One way to make it work would be to use your form.php file to get the information and verify the captcha, then instead of sending mail, POST the information to the formmail-clone.cgi url.

      Here is a thread that has code for sending POST data: http://www.phpbuilder.com/board/showthread.php?t=10344345

      Use the url to your formmail-clone.cgi script and have the fields "filled out" with the info you gathered in form.php.

        I looked at the thread you suggested and didn't understnad any of it I'm sorry.
        I've got all the data I want posted to the form.php script and got the captcha code working. What I am now having trouble with is posting this data trom the form.php script to the formmail-clone script in my cgi-bin. Any further clarification on this would be greatly appreciated. thanks for your reply.

          I want to see your form.php
          where the 'action' is.

          Just talking abstract about your pages, wont get us very far.
          At least not in next couple of weeks ...
          🙂

            here goes, if you can spot where I am going wrong that would just be grand ;O)

            <?php
            $user_code=$_POST['user_code'];
            require('php-captcha.inc.php');
            
            if (PhpCaptcha::Validate($_POST['user_code'])) {
            
            echo "<p>Thank you ".$name.", for your email<p/>";
            echo "<p>Please wait a few seconds while you are redirected ...&nbsp;&nbsp;<img src=\"images\waiting.gif\"></p>";
            echo "Your information has been sent <br /><br />";
            echo "This is what you sent  <br /><br />";
            echo "Your Name: ".$email." <br />";
            echo "Subject Line: ".$name." <br />";
            echo "Your Surname: ".$subject." <br />";
            echo "Your Comments: " .$comments." <br /><br />";
            echo "Your Captcha code: ".$user_code." <br /><br />";
            echo "<meta http-equiv=\"refresh\" content=\"15;url=mailform.php\">";
            
            $mailuser = "me@mywebsite.com";
            $header = "Return-Path: ".$email."";
            $header .= "Content-Type: text/html;";
            mail($mailuser,$subject,$contents,$email,$header);
            
            } else {
            
            echo "<p>Sorry, you have entered a invalid code... <p/>
            <p>redirecting you now ... <img src=\"images\waiting.gif\"></p>";
            echo "<meta http-equiv=\"refresh\" content=\"5;url=mailform.php\">";
            
            }
            
            ?>
            

            bearing im mind, I have changed the email address for the purposes of this post.

              Do you have the "View Source" of formmail-clone.cgi?

              What you need to do is get the field names, and 'forge' a submit page, rather than the echo back information, it would be sent to the formmail-clone.cgi through a network socket, just like a browser would.

                I dont have access to the formmail-clone script, it is all hadled by my web host. I can't view the source sorry.

                  That script is a clone of an 'Matt's' FormMail perl script, if I havent got it wrong.
                  There are a bunch of such FormMail.php scripts around.
                  Most of them FREE and OPEN SOURCE.
                  Several include CAPTCHA
                  .

                  If you have permission to use mail() function at your webspace
                  I suggest you do some google and download.

                  Google: formmail.php
                  Google: php formmail captcha

                  🙂

                    Hi guys, got it working with:

                    $mailuser = ('me@memail.com');
                    $header = "Return-Path: ".$email."";
                    $header .= "Content-Type: text/html;";
                    mail($email,$subject,$contents,$email,$header);
                    
                    $mail_body = 'User: '. $email .' has sent his input. Comments: '. $comments . '<br />'
                    ;
                    
                    mail ($mailuser, 'Form sent', $mail_body, $header);
                    

                    with $mailuser being put in parentheses and single quotes. beats me why the parentheses and single quotes were so important, but hey, it works. Now to tart it up a ilttle.

                    thanks for all your suggestions peeps, really appreciated it, made me think long and hard.

                      Write a Reply...