]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | /** For handling installation BEFORE any backend and user is configured */ | |
4 | ||
5 | require_once "../inc/common.php"; | |
6 | ||
7 | /* only let this happen pre-config */ | |
8 | if (file_exists("../config/config.php")) | |
9 | die(json_encode(["error" => "Configuration file exists."])); | |
10 | ||
11 | if (!isset($_GET) || empty($_GET)) | |
12 | die(json_encode(["error" => "Incorrect parameters"])); | |
13 | foreach($_GET as $key => $str) | |
14 | ${$key} = $str; | |
15 | ||
16 | if ($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 | } |