We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37042
    • 384 Posts
    My client has a form (using formit) and alongside the emailed results (name, email, phone), they want a unique 8 digit alpha-numberic PIN generated and included in those emailed results.

    The caveats are:

    • The PIN must start with a predefined 4 letter acronym of "MODX"
    • The PIN must end with 4 unique digits
    • Code must be unique (not generated more than once)

    I want to outsource this but am looking for a little background information before I approach someone. IE If its possible. Is it a post hook etc?
    Many thanks for the help.

      ...
      • 4172
      • 5,888 Posts
      this can be done by a hook (something like formit2db), which stores all used PINs into a db-table.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • Thinking programmatically, you should be able to write a short snippet that generates this number for you. Check out this example on Stack Overflow for some inspiration: http://stackoverflow.com/questions/3954599/generate-random-string-from-4-to-8-characters-in-php. You could set your unique prefix e.g. MODX and then append the unique value to it. I imagine you could send the value in a hidden form element if you want it to be hidden. This is a brain dump so hope it helps.

        Cheers

        Tom
          • 37042
          • 384 Posts
          Cheers guys. Appreciate the info and links.
            ...
            • 3749
            • 24,544 Posts
            I hope this is not for banking or anything else that requires real security, and if I'm understanding you, you can only have 999 users. wink
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 37042
              • 384 Posts
              Quote from: BobRay at Apr 20, 2013, 06:38 AM
              I hope this is not for banking or anything else that requires real security, and if I'm understanding you, you can only have 999 users. wink

              LOL, no! Definitely not for banking. I only used the word "PIN" for convenience sake.
              I know the max number of submissions will come to 9999 but that's plenty for the mo.
                ...