I'm not really sure where this goes, presumably it'd be helpful in releases, but it's not really a release (a plugin), so I'll post it here, and you can do with it what you want.
You should be aware that this will give superadmin to everyone who fits the query parameters. I will try and support this for at least a few weeks if anyone needs significant help with getting it to assign a larger variety of flags.
I tried to comment it up as much as possible, so that anyone can get it working. You'll need to know how to run a Cron task, or have enough time to run it manually. Although I shouldn't have to mention it, you should know your server's hostname. On that note, please be aware that, if you're hosting it on the same box, it's 99% of the time "localhost". In addition, if it were localhost, you'd set hostname to "localhost:port". Make sure to include the port, it's important. Here's the code:
<?php
//Coded by Snowden42
//It queries the Sourcebans mysql database and then dumps the sb_admins table in the garrysmod data folder in a format readable for ULX.
//You'll want to run this through Cron, or you'll have to manually connect to it through your browser.
//The MySQL variables are defined below
$hostname = '';
$username = '';
$password = '';
//Location of users.txt
//For path, please be aware that you must escape backslashes on the Windows platform. Thus, it is simpler just to use forward slashes.
//Fill in the "..." with the path to Orangebox. The path may or may not start in "C:\\" depending on what system you're on.
$handle = fopen("C:\\...\orangebox\garrysmod\data\ulib\users.txt", "w");
if(!$handle){
die('Failed to Open Users.txt</br>');
};
echo('Opened Users.txt Successfully</br>');
//Connect to the database
$mysql_connect = mysql_connect($hostname, $username, $password);
if(!$mysql_connect){
die('Unable to Connect: '. mysql_error().'</br>');
};
echo('Connected Successfully</br>');
//Select correct database
$db = mysql_select_db('sb', $mysql_connect);
if(!$db){
die('Can\'t use sb: '. mysql_error().'</br>');
};
echo('Database Selected Properly</br>');
//Query the database
//If you only use sb_admins to store admins (we store people with donor flags in it as well) leave it as is.
//The MySQL query syntax is relatively simple. You should be able to figure out how to query specific users with a simple google search.
$query = mysql_query("SELECT * FROM sb_admins", $mysql_connect);
while($row = mysql_fetch_array($query)){
$write = fwrite($handle, '"'.$row['authid'].'"
{
"deny"
{
}
"name" "'.$row['user'].'"
"allow"
{
}
"group" "superadmin"
}
');
};
//Catch errors during writing
if(!$write){
echo('An Error Occured During Writing</br>');
} else{
echo('Writing Successful</br>');
};
//Close users.txt
$fclose = fclose($handle);
if(!$fclose){
die('Unable to Close Users.txt');
};
echo('Closed Users.txt');
?>
I hope that this code helps someone, I can tell you for certain it definitely helps me. While the lua code was probably more efficient and effective, I guarantee this code works. In addition, it will tell you if there were errors when you run it manually, so I recommend you do so to guarantee that it does indeed work on your system.
If you have any questions or problems, feel free to leave them here.