]>
Commit | Line | Data |
---|---|---|
78069032 VP |
1 | <?php |
2 | ||
54b9603c BM |
3 | /** For handling installation BEFORE any backend and user is configured */ |
4 | ||
78069032 VP |
5 | require_once "../common.php"; |
6 | ||
f0106ef0 VP |
7 | /* only let this happen pre-config */ |
8 | if (file_exists("../config/config.php")) | |
9680dd58 | 9 | die(json_encode(["error" => "Configuration file exists."])); |
78069032 VP |
10 | |
11 | if (!isset($_GET) || empty($_GET)) | |
9680dd58 | 12 | die(json_encode(["error" => "Incorrect parameters"])); |
78069032 | 13 | foreach($_GET as $key => $str) |
9680dd58 | 14 | ${$key} = $str; |
78069032 | 15 | |
54b9603c | 16 | if ($method == "sql") |
78069032 | 17 | { |
9680dd58 | 18 | $conn = mysqli_connect($host, $user, $password, $database); |
78069032 | 19 | |
9680dd58 VP |
20 | // check connection |
21 | if (mysqli_connect_errno()) | |
22 | die(json_encode(["error" => "Failed to connect to MySQL: " . mysqli_connect_error()])); | |
78069032 | 23 | |
9680dd58 VP |
24 | // close connection |
25 | mysqli_close($conn); | |
26 | die(json_encode(["success" => "SQL Connection successful"])); | |
78069032 | 27 | |
54b9603c | 28 | } |