access for 24 hours after first login?

Jonathan De Graeve Jonathan.De.Graeve at imelda.be
Thu Oct 6 22:45:07 CEST 2005


>It doesn't work on postgresql v7.4.6 that I tried it on.. howver, I
used 
>
>"SELECT now() - AcctStartTime FROM radacct WHERE UserName = '%{%k}'
>LIMIT 1;"
>

Be carefull with this!!!!!


"SELECT now() - AcctStartTime Secs
FROM radacct 
WHERE UserName = '%{k}' LIMIT 1;" 

Gives for example with username 'test': 
+-----------+
| Secs      |
+-----------+
| 684042112 |
+-----------+

Recalculated in days: 7917,1540740740740740740740740741 days....

Is NOT the same as: 

"SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) Secs 
FROM radacct
WHERE UserName = '%{%k}' LIMIT 1"

Gives for example with username 'test':
+----------+
| Secs     |
+----------+
| 17119330 |
+----------+

Recalculated in days: 198,14039351851851851851851851852

198days is the correct calculation...

So as you can see, it isn't the same, at least in MySQL, don't know with
other databases.
So before you you begin: think, try and check your things.

J.





More information about the Freeradius-Users mailing list