Advanced Registration Form with validation against an external db table

Discussion in 'Customization & add-ons' started by polaris, Jan 1, 2020.

Thread Status:
Not open for further replies.
  1. polaris

    polaris aMember Pro Customer

    Dec 31, 2019

    and Happy New Year 2020!

    I just bought aMember Pro because I need to use it to replace my current users private area system.

    At this moment, I am using an old php script (called Member Guardian) that was discontinued.

    I highly customized the script during last years, but now it became very difficult to mantain it, due to recent changes in PHP.

    I don't have time nor skills to convert it from PHP 5.6 code to PHP 7.1 and more.

    So I went to aMember, to find a definitive powerful solution, mantained and stable.

    Here are my requests.

    Using my old script, I created a way to register products warranties and to let verified customers to access a private area from where they can download user manuals and new firmware updates.

    To validate customers during their registration, my system at this moment do these procedures:
    1. Check in real-time (by Ajax) if the serial number of the product inserted by customer is present in my serial numbers database (one serial numbers' table for each different model);
    2. Check if someone else already registered that serial number and, in that case, it stops registration (two users cannot own same product identified by a unique serial number);
    3. If serial number is not present in my database, it stops continuing in registering process;
    Now, with my old script, the customer has to choose from different registration forms: one per each model (so registration-form1 for ProductModel1, registration-form2 for ProductModel2, and so on).

    So, from there on, the serial number check verification will happen comparing the text box filled by customer to the specific mysql table of serial numbers related to that specific model.

    It is all good, but this approach is not so comfortable if customer, during time, will buy also a new different model or maybe two identical models but having (of course) different serial numbers (In this case, I have to manually edit his account and add the new data to it).

    So, in aMember, I think the best approach is to not use different forms, but one only form, based on different products models (checkboxes or dropdown menu to choose from "ProductModel1", "ProductModel2", "ProductModel3", and so on).

    Then, using a conditional form, the registration form should show the correct "serial number" text box specific to the model selected during registration.

    For example:

    Customer selects "ProductModel1" and registration shows "InsertSerialNumberForModel1" text box.

    This text box should compare and check (by ajax, like now already happens for username) the inserted value by customer with the specific table of serial numbers for "ProductModel1".

    In addition, it should also check if someone else has already registered that same serial number and stop registration in that case, showing an error "this serial number was already used!".

    My goal is also to let customer to add more models by himself.

    So, if at first he bought "ProductModel1" and registered himself to my system using that model's serial number, then he could buy a different "ProductModel2" and register also it the his same account (so he will have two products, or more, in his area).

    I tried by myself to add some code to the "site.php" file, following some cues I found in forum on in your github repository.

    But, at least for now, I am not able to perform a query to a different database, nor I can add some kind of ajax realtime check.

    So, in a few words, I am stucked.

    Do you have some more suggestions to achieve these goals, please? Thanks in advance for any help.
  2. polaris

    polaris aMember Pro Customer

    Dec 31, 2019
    I solved it
Thread Status:
Not open for further replies.

Share This Page