-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_mysql.php
32 lines (29 loc) · 983 Bytes
/
setup_mysql.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$hostname = $_POST["mysql_hostname"];
$username = $_POST["mysql_username"];
$password = $_POST["mysql_password"];
$database = $_POST["mysql_database"];
error_reporting(0);
$conn = new mysqli($hostname, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Can't connect to MySQL server.");
}
$main = file_get_contents("config/main.php");
$main = str_replace('$mysql_status = 0;', '$mysql_status = 1;', $main);
file_put_contents("config/main.php", $main);
include "config/main.php";
if ($reg_status == 1 && $mysql_status == 1) {
$main = file_get_contents("config/main.php");
$main = str_replace('$server_status = 0;', '$server_status = 1;', $main);
file_put_contents("config/main.php", $main);
}
file_put_contents("config/connection.php", '
<?php
$hostname = "' . $hostname . '";
$username = "' . $username . '";
$password = "' . $password . '";
$database = "' . $database . '";
?>
');
echo 1;