Jump to content

Module Custom Field Validation Function


eFishy

Recommended Posts

Hi Everyone,

 

I am currently making a plug-in for whmcs and I could do with a little bit of helpful insight.

 

Basically the module is based around a product that will make changes to a servers network, obviously the validation needs to be quite strong to ensure that one client doesn't "accidentally" effect another clients server.

 

So when they are ordering the product we will have a custom field, which they enter in the public IP address's of their server, at this point I use the regular expression to ensure that its part of our public subnet etc, so that's the basic validation.

 

However I want to go one step further and make sure it's their IP and not another clients, so they don't apply the service to a random server. Basically Here I want to run one of my php functions. This function will go off, query the mysql, and check the IP field of all the current active client products (where we always insert the client's allocated IP's). If the IP is found then it will return true, otherwise false etc... Ensuring that they have rights to control the entered IP.

 

The problem I have is this validation needs to occur at the same time the regular expression validation occurs, so I can feedback the error to the user, without creating the invoice and taking payment etc...

 

Coding this on the create function would be fine, however they have already paid and been invoice by then, which would cause hell for our accounts.

 

Finally I would hopefully want to do this without too many modifications, our system runs many modules and potential I may want to release this as a module for others to use in the future... Although ideas to get it working would be greatly appreciated.

 

Thanks for taking the time to read :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated