Jump to content

Need Help with updating external radius database


webcoaster

Recommended Posts

I just purchased WHMCS along with the FreeRadius module and I need to insert some speed values into the radreply table of my Radius database.

 

I'm new to PHP and I'm not sure how to pull the correct value out of the array and insert it into the database.

 

I have the insert function working fine, it's just these two fields that continue to be blank. So I know that I'm not calling it correctly which explains why the field is blank.

 

I have not decided which to use yet so I've been trying both custom fields and Configurable options and of course nether will work as by skills are not up to par.

 

Based on what Matt has told me so far, the custom fields are passed into the function as an array in the $params["customfields"] variable, for example "Upload Speed" would be $params["customfields"]["Upload Speed"]

 

Can I also assume that the configurable options passed the same way except they would use

$params["configoptions"].

 

So how do you include either of these into the module and then call it so that the database insert will pull the correct value and insert it in the proper location.

 

So far this is what I have for the configoptions test, so far and of course it's not working,

 

$configoptions = $params["configoptions"]; # Array of configurable option values for the product

extract($configoptions);

# Product module option settings from ConfigOptions array above

$configoptions1 = $params["configoptions1"];

$configoptions2 = $params["configoption2"];

$configoptions3 = $params["configoption3"];

$configoptions4 = $params["configoption4"];

 

Then to insert I have

 

$query = "INSERT INTO radreply (username,attribute,value,op) VALUES ('$username','WISPr-Bandwidth-Max-Down','$configoption[1]',':=')";

 

$query = "INSERT INTO radreply (username,attribute,value,op) VALUES ('$username','WISPr-Bandwidth-Max-Up','$configoption[2]',':=')";

 

Any help at all would be appreciated

Thanks in advance

-Cheers

Link to comment
Share on other sites

Matt got me straight on the code, thanks to all who had looked at this.

 

The PHP code I used was invalid, below is the correct way.

 

$dlspeed = $params["configoptions"]["Download Speed"]; # Added by wc

$ulspeed = $params["configoptions"]["Upload Speed"]; # Added by wc

 

-Cheers

Link to comment
Share on other sites

Matt got me straight on the code, thanks to all who had looked at this.

 

The PHP code I used was invalid, below is the correct way.

 

$dlspeed = $params["configoptions"]["Download Speed"]; # Added by wc

$ulspeed = $params["configoptions"]["Upload Speed"]; # Added by wc

 

-Cheers

 

Hi, I've just got WHMCS and trying to work out where you setup these configoptions against a product so I can pass variables to a phpscript. I can see Custom Fields tab, is this it, but then how do you set the default VALUE?

 

So confused... :?

 

Nev

Link to comment
Share on other sites

  • 1 month later...

What, exactly, did you enter into the fields when setting up your freeradius module?

 

You don't have to tell me your exact hostname, but can you tell me exactly what you put in your fiends so that we can duplicate them over here. Our module does not seem to be contacting the remote freeradius server.

 

We know the server is operating because we have tested it both with radtest and with daloradius (which has build in test facilities to contact the freeradius server).

 

While running the server with the -X parameter, we see the responses from these tests, but when attempting to get whmcs to contact the server, it fails with "Module Command Error - FreeRadius Database Query Error: " and I see absolutely no response from freeradius in debugging mode.

 

when we run radtest sqltest testpwd localhost 1812 testing123, we see a response response.

 

Here is what we have so far for whmcs:

 

started the freeradius daemon in debugging mode ( -X)

iptables off

 

----- whmcs freeradius server config

 

IP Address: 67.xxx.xxx.xxx

Username: root (same as used for daloradius with no problems)

pw: xxxxxxxxxxxxx (same as used for daloradius with no problems)

hash: radius (same as used for daloradius with no problems)

 

 

Products/Services

Module Setting

Group Name: usergroup

 

as long as the hostname is correct there should by a response showing in shell

when running 'radiusd -X' , right?

 

also, daloradius is on the same machine as the radius server.

the whmcs installation is remote.

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