]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame_incremental - api/installation.php
Move some PHP files from ./ to ./inc: common, connection, header, footer
[irc/unrealircd/unrealircd-webpanel.git] / api / installation.php
... / ...
CommitLineData
1<?php
2
3/** For handling installation BEFORE any backend and user is configured */
4
5require_once "../inc/common.php";
6
7/* only let this happen pre-config */
8if (file_exists("../config/config.php"))
9 die(json_encode(["error" => "Configuration file exists."]));
10
11if (!isset($_GET) || empty($_GET))
12 die(json_encode(["error" => "Incorrect parameters"]));
13foreach($_GET as $key => $str)
14 ${$key} = $str;
15
16if ($method == "sql")
17{
18 $conn = mysqli_connect($host, $user, $password, $database);
19
20 // check connection
21 if (mysqli_connect_errno())
22 die(json_encode(["error" => "Failed to connect to MySQL: " . mysqli_connect_error()]));
23
24 // close connection
25 mysqli_close($conn);
26 die(json_encode(["success" => "SQL Connection successful"]));
27
28}