If you want to import into freeradius from a file you could try something along these lines.
`$file_handle = fopen("users.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$sStream .= $line_of_text;
}
fclose($file_handle);
$arUsers = explode("\n", $sStream);
$sUserCount = count($arUsers)-1 ;
for ($i = 0;$i< $sUserCount; $i++){
$sTmp = $arUsers[$i];
$arAcct = explode(",",$sTmp);
if ( AddXML(false,$arAcct) ) AddDbUser ($arAcct);
if ( $i > $sUserCount ) break;
}
function AddDBUser($fDebug,$arAcct){
include "opendb.php";
$SQL = "INSERT INTO radcheck (UserName, Attribute, op, Value) VALUES ('$arAcct[0]', 'User-Password', ':=', '$arrAcct[0]');";
$QResult = mysql_query($SQL);
include "closedb.php";
}`
users.csv is simply a list of username password pairs eg fred, apples\n tom, oranges
opendb.php and closedb.php are included pages to handle the connection to the radius db
Obviously thats ver simple only using the usename passwrod pair, it would be no hassle at all to extend it to add additional radius attributes
Its a bit rough and ready and probably has some errors as I just jotted it down from memory of past stuff I've done. I do hope it helps some one
Regards
Nick