I'm trying to script adding/removing users from a RADIUS server using PHP and I'm not having much luck finding documentation anywhere that can help me. I found this script that connects to a port on the RADIUS server and sends commands to change a password for a user....now I need to know how to add/delete users.
Anyone know about this, or could point me to the right place for documentation?
$passd = fsockopen($server, $port, &$errno, &$errstr);
$input = fgets($passd, 128);
if(!eregi( "^200", $input)){
fclose($passd);
$errortype="no_connect";
}
$output = "user ". $user . "\n";
fputs($passd,$output);
$input = fgets($passd, 128);
if(!eregi( "^200", $input)){
fclose($passd);
$errortype="$input";
}
$output = "pass " . $old_pass . "\n";
fputs($passd,$output);
$input = fgets($passd, 128);
if(!eregi( "^200", $input)){
fclose($passd);
$errortype="$input";
}
$output = "newpass $new_pass\n";
fputs($passd,$output);
$input = fgets($passd, 128);
if(!eregi( "^200", $input)){
fclose($passd);
$errortype="$input";
}
$output = "quit\n";
fputs($passd,$output);
$input = fgets($passd, 128);
if(!eregi( "^200", $input)){
fclose($passd);
$errortype="$input";
}
fclose($passd);