View Single Post
  #2  
Old 26th October 2009, 19:04
awe awe is offline
Junior Member
 
Join Date: May 2009
Location: Tossa de Mar (Girona) Spain
Posts: 17
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Problem solved. A few hours on Google did the trick. The thing is that I had never used any SQL and I did not know a word about it. So, in case anyone is in my situation, this is what I did.

RADCHECK table has these fields as standard: Username, Attribute, op, and Value. I added two new fields after that: StartDay and EndDay. The first contains the first day when the connection can be authorised and the other one contains the last day.

The query is:

Code:
        authorize_check_query = "SELECT id, UserName, Attribute, Value, op \
          FROM ${authcheck_table} \
          WHERE Username='%{SQL-User-Name}' AND curdate()>=StartDay AND curdate()<=EndDay \
          ORDER BY id"

        authorize_reply_query = "SELECT id, UserName, Attribute, Value, op \
          FROM ${authreply_table} \
          WHERE Username='%{SQL-User-Name}' AND curdate()>=StartDay AND curdate()<=EndDay \
          ORDER BY id"
It's easy and straightforward, but not so much so when it's the first time you are to type a MySQL query and have to Google even for the basics.

Now I am going to make the booking engine to write to RADCHECK in the RADIUS database. A new reservation will create a user and its password (name and reservation code), and insert arrival and departure days for the customer in order to authorise the connection only when the guest is staying at the apartments. No effort involved, all automatic, all the way it should be.

Last edited by awe; 26th October 2009 at 19:06.
Reply With Quote