We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17029
    • 8 Posts
    Hi!

    Anyone try to use PHPcaptcha script with MODx CMS? When I try it, I so secure image, but even if I enter correct code, the sample script report, that code is wrong. I think, there is some problems with session, but couldn’t detect them. I try the same code outside MODx CMS, it works without any problem.
      • 4749
      • 623 Posts
      Levonty,
      You may want to post as much information as possible about your problem. If you’re talking about code, in order to help you’ll need to post your code and system configuration, etc.

      Quote from: rthrash at Feb 07, 2007, 10:43 AM

      And finally, to duplicate a post that bears repeating in this thread:

      When making support requests, please make sure to provide information about your web server and your client machine:

      Web Server:
      • PHP version and how it’s running (suexec, mod_php, CGI, etc.)
      • Apache or IIS version
      • Operating System and version


      Database:
      • MySQL version
      • List of any tables over 1MB in size


      MODx:
      • Version
      • Any changes you’ve made
      • Any snippets you’re running on the page that is not working properly
      • Any plugins you’re running


      Browser/Client:
      • Browser name and version
      • Operating System and version


      This will go a long way towards being able to quickly resolve or duplicate and bugs as applicable, and should result in a better overall support experience.

      Further, if you’re seeing problems with snippets not seeming to work right, make sure you’re enclosing parameters in back-tics, not single-quotes. On US-English keyboards that’s the key typically found at the top-left of the number row: `

      Thanks!


        The MODx has you...
        Utah Web Design
        • 17029
        • 8 Posts
        Yeah, I think I should explain in details smiley

        I try sample script on MODx CMS version 0.9.2.1 - 0.9.6.1p2
        PHP/4.3.11
        Apache, Linux

        Form is very Simple.

        <?php
        if (empty($_POST)) {
        echo "<form method=’POST’>Username:
        <input type=’text’ name=’username’ />

        Password:
        <input type=’text’ name=’password’ />

        <img src=’/securimage/securimage_show.php?sid=".md5(uniqid(time()))."’>

        <input type=’text’ name=’code’ />
        <input type=’submit’ value=’Submit Form’ /></form>";
        } else {
        include($_SERVER[’DOCUMENT_ROOT’] . ’/securimage/securimage.php’);
        $img = new Securimage(); //create phpcaptcha object
        $valid = $img->check($_POST[’code’]); //check code from input
        if($valid == true) {
        echo ’<center>Thanks, you entered the correct code.</center>’; }
        else {
        echo ’<center>Sorry, the code you entered was invalid. <a href=\’javascript:history.go(-1)\’>Go back</a> to try again.</center>’;
        }
        }
        ?>

        As I mentioned above, the same code outside MODx CMS works correct. Inside MODx I always receive the same message after submitting form: "Sorry, the code you entered was invalid. "
          • 4749
          • 623 Posts
          Levonty,
          I do front-end code, not PHP. But, I know you can create your own snippets that run inside ModX. Just read this and this then you should have a better understanding of how to implement your own snippet. Then maybe it will make sense as to why yours isn’t working. Also, look in the snippet code in the manager of your installation and view the eForm snippet.
            The MODx has you...
            Utah Web Design
            • 17029
            • 8 Posts
            cbaone,

            of course the code above situated inside snippet, named ’SimpleForm’. I called this snippet like [!SimpleForm!].
            Yes, I know about eForm snippet, but for several reason it not suits, for example I have several projects not under MODx, and it’s more simply for me to use one universal construction.
            I have just receive email from PHPCAPTCHA developer, he tolds that such problem can occurs if MODx use custom session name. Anybody knows, how I can check it?
              • 31082
              • 1 Posts
              Hi,

              I have found solution to this, you should still verify if all the steps I did are really neccessary.

              Put into the constructor of securimage following code:

              global $site_sessionname;
              require(realpath(dirname(__FILE__).'/../../../../manager/includes').'/config.inc.php');
              startCMSSession();
              session_name($site_sessionname);


              you should replace the path to config file with correct path.

              Enjoy,
              Jan