Jump to content

Adding API ip addres not working


haaser

Recommended Posts

I am trying to allow API access to my WHMCS and it is not working. When I add the ip address and click save the ip is not in the list. I am looking over the actual database but I can not find the location where it is suppose to be. Is anyone else having problems or am I doing something wrong?

Link to comment
Share on other sites

So I found the table and added the ip address. I had to copy the format from the whitelist ip field to make it work but I believe that I got it in there. It is under tbl_configuration. You can not save the Security page after you add it in the database or it will delete it.

Link to comment
Share on other sites

I submitted a ticket on this as a bug. To work around for the moment for those needing to (including I'm sure most of the fellow developers customers out there that utilize the API):

 

1) Visit http://serialize.onlinephpfunctions.com/

2) In the "Execute Serialize Value" field enter:

 

array( array( 'ip' => '127.0.0.1','note' => 'Computer' ) );

 

Where the 127.0.0.1 and note are your own notes. If you have multiple IPs you need added, do this:

 

array( array( 'ip' => '127.0.0.1','note' => 'Computer' ), array( 'ip' => 127.0.0.2', 'note' => 'Computer 2' ) );

 

3) Execute the field and copy the resulting value. It is a serialized value that you'll need to use in your settings.

4) Open your database table in PHP MyAdmin (or whatever you use) and find the table `tblconfiguration` and find 'APIAllowedIPs'. Paste the data you copied in step 3 into the corresponding value for the table.

5) Save the table and verify in WHMCS that your IP addresses are in place.

 

DONT edit the field in the settings now that they are in there... they get lost and you'll have to do it again.

 

Hopefully will be resolved in 5.2.2 or whatever comes next.

Link to comment
Share on other sites

I submitted a ticket on this as a bug. To work around for the moment for those needing to (including I'm sure most of the fellow developers customers out there that utilize the API):

 

Thanks for the workaround, it worked perfectly, but I'm going to have to tell my coworkers not to hit the "Save Settings" button anymore (because even changing another setting breaks the API IP list).

 

If it's a problem I'll have to write a PHP script on a CRON job...

"UPDATE tblconfiguration SET value='a:1:{i:0;a:2:{s:2:"ip";s:13:"192.168.1.254";s:4:"note";s:6:"LAN IP";}}' WHERE setting='APIAllowedIPs' LIMIT 1"

...every 5 minutes.

 

What a massive PITA :P

Link to comment
Share on other sites

Incidentally shortly after posting this, I got a response from support on this issue. They forwarded me an updated file to include in my installation (which I have attached).

 

The file goes in the admin folder - but you should note that it only works for adding IP addresses to the configuration, the removal is still not working, but at least you don't have to hack into the database to get an IP added now.

APIAllowedIPsFix.zip

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