. * * Version 0.1 * Author: Daniel Larraz */ function write_fr_users ($filepath, $input, $writepath='') /* ------------------------------------------------------------------------ */ { global $base_plugin; if ($writepath=='') { $writepath=$base_plugin.'data/temp_fr_users'; } $fp=fopen ($writepath,"w"); foreach ($input as $user => $attrs) { fwrite ($fp, "\"".$user."\"\tCleartext-Password := \"".$attrs['Cleartext-Password']."\"\n"); if ($attrs['Login-Time']) { fwrite ($fp, "\tLogin-Time = \"".$attrs['Login-Time']."\",\n"); } if ($attrs['Session-Timeout']) { fwrite ($fp, "\tSession-Timeout <= ".$attrs['Session-Timeout']."\n"); } } fclose ($fp); exec ('sudo mv '.$writepath.' '.$filepath); exec ('sudo chown root:freerad '.$filepath); } /* ------------------------------------------------------------------------ */ ?>