]>
Commit | Line | Data |
---|---|---|
03ddd26b BM |
1 | <?php |
2 | ||
00db45aa | 3 | if (!defined('UPATH')) |
55fd88eb | 4 | die("Access denied"); |
00db45aa | 5 | |
03ddd26b | 6 | if (!defined('UNREALIRCD_RPC_USER') || |
55fd88eb VP |
7 | !defined('UNREALIRCD_RPC_PASSWORD') || |
8 | !defined('UNREALIRCD_HOST') || | |
9 | !defined('UNREALIRCD_PORT') | |
03ddd26b BM |
10 | ) die("Unable to find RPC credentials in your config.php"); |
11 | ||
12 | $tls_verify = (defined('UNREALIRCD_SSL_VERIFY')) ? UNREALIRCD_SSL_VERIFY : true; | |
13 | $api_login = UNREALIRCD_RPC_USER.":".UNREALIRCD_RPC_PASSWORD; | |
14 | ||
15 | /* Connect now */ | |
16 | try { | |
55fd88eb VP |
17 | $rpc = new UnrealIRCd\Connection |
18 | ( | |
19 | "wss://".UNREALIRCD_HOST.":".UNREALIRCD_PORT, | |
20 | $api_login, | |
88cae748 | 21 | ["tls_verify" => $tls_verify] |
55fd88eb | 22 | ); |
11c301be BM |
23 | } |
24 | catch (Exception $e) | |
25 | { | |
26 | echo "Unable to connect to UnrealIRCd: ".$e->getMessage() . "<br><br>"; | |
27 | echo "Verify your connection details in config.php (rpc user, rpc password, host) and ". | |
28 | "verify your UnrealIRCd configuration (listen block with listen::options::rpc and ". | |
29 | "an rpc-user block with the correct IP allowed and the correct username and password)."; | |
30 | throw $e; | |
03ddd26b | 31 | } |