summaryrefslogtreecommitdiff
path: root/setup.php
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2022-04-16 20:51:20 -0700
committerlshprung <lshprung@yahoo.com>2022-04-16 20:51:20 -0700
commitd698e6eb153c956de48fb6a06d91844accc0f895 (patch)
tree7b27112541ffeeb124efe4edf1fe4b703be007af /setup.php
parentb54e381e0419022d5a686c5729744b93b9d5692c (diff)
Added additional fields for setup.php
Diffstat (limited to 'setup.php')
-rw-r--r--setup.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/setup.php b/setup.php
index 0e7a9cc..0108510 100644
--- a/setup.php
+++ b/setup.php
@@ -16,14 +16,22 @@ if($check == "y"){
die("Error: Cannot open file \"$config_path\"\n");
}
- $input["hostname"] = readline("Enter hostname [default: localhost]: ");
- if(!$input["hostname"]) $input["hostname"] = "localhost";
+ $input["hostname"] = readline("Enter hostname [leave blank for default]: ");
$input["username"] = readline("Enter username: ");
- $input["password"] = readline("Enter password: ");
+ $input["password"] = readline("Enter password [leave blank for no password]: ");
$input["database"] = readline("Enter database: ");
+ $input["port"] = readline("Enter port number [leave blank for default]: ");
+ $input["socket"] = readline("Enter socket [leave blank for default]: ");
fwrite_wrapper($handle, "<?php\n\n");
- fwrite_wrapper($handle, "\$db = mysqli_connect(\"" . $input["hostname"] . "\", \"" . $input["username"] . "\", \"" . $input["password"] . "\", \"" . $input["database"] . "\");\n");
+ fwrite_wrapper($handle, "\$db = mysqli_connect(\"" .
+ $input["hostname"] . "\"" .
+ ", \"" . $input["username"] . "\"" .
+ ", \"" . $input["password"] . "\"" .
+ ", \"" . $input["database"] . "\"" .
+ (!$input["port"] ? "" : ", " . $input["port"]) .
+ (!$input["socket"] ? "" : ", \"" . $input["socket"] . "\"") . ");\n"
+ );
fwrite_wrapper($handle, "if(!\$db) die(\"Failed to connect to database: \" . mysqli_connect_error());\n\n");
fwrite_wrapper($handle, "?>");