]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - api/installation2.php
Move some PHP files from ./ to ./inc: common, connection, header, footer
[irc/unrealircd/unrealircd-webpanel.git] / api / installation2.php
CommitLineData
54b9603c
BM
1<?php
2
c06c1713 3require_once "../inc/common.php";
54b9603c
BM
4
5/* only let this happen */
6if (isset($config['unrealircd']) && empty($config['unrealircd']['host']))
7 die(json_encode(["error" => "Already configured."]));
8
9if (!isset($_GET) || empty($_GET))
10 die(json_encode(["error" => "Incorrect parameters"]));
11
12foreach($_GET as $key => $str)
13 ${$key} = $str;
14
15if ($method == "rpc")
16{
17 if (isset($tls_verify))
18 {
19 if ($tls_verify == "false")
20 $tls_verify = false;
21 elseif ($tls_verify == "true")
22 $tls_verify = true;
23 }
24 try {
25 $rpc = new UnrealIRCd\Connection
26 (
27 "wss://$host:$port",
28 "$user:$password",
29 ["tls_verify" => $tls_verify]
30 );
31 }
32 catch (Exception $e)
33 {
34 die(json_encode(["error" => "Unable to connect to UnrealIRCd: ".$e->getMessage()]));
35 }
36 die(json_encode(["success" => "Successfully connected"]));
37}