eFishy Posted August 10, 2010 Share Posted August 10, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted August 11, 2010 Share Posted August 11, 2010 You'll need to do the validation either by javascript on the entry of the ip, or by a "Hook" to precheckout 0 Quote Link to comment Share on other sites More sharing options...
eFishy Posted August 11, 2010 Author Share Posted August 11, 2010 I assume that the JavaScript validation would need to be inserted into the order page template? Out of the two think the best would be action hooks, would make the module more "portable" and easy to install for the end user. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted August 11, 2010 Share Posted August 11, 2010 You'll have to use an action hook anyways to validate against existing IP addresses. 0 Quote Link to comment Share on other sites More sharing options...
eFishy Posted August 11, 2010 Author Share Posted August 11, 2010 Cool thanks for the into. Will have a play around with "hooks" 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.