Radius Rejecting a User Based On Credit

i am using freeradius 1.0.4 (doing AAA using postgresql 8.0.3) as a radius server for mikrotik 2.8.27.
when a hotspot user attempts to login via mikrotik and has access rejected by the radius server, i want to be able to display custom error messages on the hotspot servlet that depend on the reason for rejection… e.g.,
if the user enters the correct username and password, but has no credit available (as per the postgresql radius db) then i display ‘no credit available’
otherwise, if the username or password is invalid then i display ‘invalid username or password’.
i have tried using sql and php to get around this, but have found no solution.
is there a direct, secure approach to solving my problem?

As far as I know, % error % stands for Reply-Message RADIUS attribute. Try it.

thanks for the suggestion… i’ve subsequently decided to circumvent the issue by having my verification done off-site, i.e. when the user logs in, the username & password (as well as credit status) are checked in the radius database using php… if the user has the right pwd and sufficient credit, then the info is passed through to the freeradius server from the mikrotik client.

telerad - I want to achieve something similar. What steps did you take to get the information back from PHP to the hotspot login? Did you just write a custom form which posts the information back to the hotspot servlet?