3 require_once "../inc/common.php";
5 if (!isset($_POST) || empty($_POST))
6 die(json_encode(["error" => "Incorrect parameters"]));
8 foreach(array("tls_verify","host","port","user","password","edit_existing") as $k)
10 if (!isset($_POST[$k]))
15 if ($tls_verify == "false")
17 elseif ($tls_verify == "true")
20 if (($edit_existing) && ($password == "****************"))
22 /* If editing existing and password unchanged,
23 * try to look up existing password.
25 if (isset($config["unrealircd
"][$edit_existing]))
27 $password = $config["unrealircd
"][$edit_existing]["rpc_password
"];
28 if (str_starts_with($password, "secret
:"))
29 $password = secret_decrypt($password);
34 $rpc = new UnrealIRCd\Connection
38 ["tls_verify
" => $tls_verify]
43 die(json_encode(["error
" => "Unable to connect to UnrealIRCd
: ".$e->getMessage()]));
46 die(json_encode(["success
" => "Successfully connected
"]));