X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/ea27475b363f4dd337b5bbee5ec0961fecce1bf1..ea90b321a4b3768028d841b307c362af97a5e6e1:/plugins/sql_auth/SQL/sql.php diff --git a/plugins/sql_auth/SQL/sql.php b/plugins/sql_auth/SQL/sql.php index 6de0d6c..b325c96 100644 --- a/plugins/sql_auth/SQL/sql.php +++ b/plugins/sql_auth/SQL/sql.php @@ -2,13 +2,17 @@ function sqlnew() { - $host = SQL_IP; - $user = SQL_USERNAME; - $pass = SQL_PASSWORD; - $db = SQL_DATABASE; + $host = get_config("mysql::host"); + $user = get_config("mysql::username"); + $pass = get_config("mysql::password"); + $db = get_config("mysql::database"); $charset = 'utf8mb4'; - $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; + if ($host[0] == "/") + $host_type = "unix_socket"; + else + $host_type = "host"; + $dsn = "mysql:$host_type=$host;dbname=$db;charset=$charset"; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,