This repository was archived by the owner on Feb 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathinstall.php
More file actions
108 lines (90 loc) · 2.3 KB
/
install.php
File metadata and controls
108 lines (90 loc) · 2.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
$config_file = "config";
//if config file not exist; create
if(!file_exists($config_file))
{
$fh = fopen($config_file, "w");
if(!$fh)
{
die("cannot create file, try manually creating a file named <b>config</b> in this directory.");
}
fclose($fh);
die("config file not found.<br/>creating config file<br/>file created<br/><a href=\"install.php\">Try the install again</a>");
}
//check file perms
if(!is_writable($config_file))
{
die("please change permissions of config file to ");
}
if($_POST)
{
$fh = fopen($config_file, "w");
fwrite($fh, json_encode([
"db_host" => $_POST['db_host'],
"db_user" => $_POST['db_user'],
"db_pass" => $_POST['db_pass'],
"db_db" => $_POST['db_db'],
"cap_sec_key" => $_POST['cap_sec_key'],
"cap_site_key" => $_POST['cap_site_key']
]));
fclose($fh);
include("Db.class.php");
$db = new Db();
$db->installTables();
die("config file created. please delete this file (install.php).");
}
?>
<style>
body
{
background-color: #000;
}
form section
{
background-color: #ccc;
border-radius: 1rem;
padding: 1rem;
}
p.section_header
{
border-bottom: 0.3rem solid #000;
font-size: larger;
color: #c00;
}
form section p label
{
display: table;
}
</style>
<form method="post">
<section>
<p class="section_header">Database Configuration</p>
<p>
<label for="db_host">Database Host</label>
<input type="text" id="db_host" name="db_host" placeholder="127.0.0.1" required />
</p>
<p>
<label for="db_db">Database Name</label>
<input type="text" id="db_db" name="db_db" placeholder="doxbin" required />
</p>
<p>
<label for="db_user">Database User</label>
<input type="text" id="db_user" name="db_user" placeholder="username" required />
</p>
<p>
<label for="db_pass">Database Password</label>
<input type="text" id="db_pass" name="db_pass" placeholder="password" required />
</p>
<p class="section_header">Captcha Configuration</p>
<p><i>This is not required.</i></p>
<p>
<label for="cap_site_key">Google ReCaptcha Site Key</label>
<input type="text" id="cap_site_key" name="cap_site_key" />
</p>
<p>
<label for="cap_sec_key">Google ReCaptcha Secret Key</label>
<input type="text" id="cap_sec_key" name="cap_sec_key" />
</p>
<p><button type="submit">Save Settings</button></p>
</section>
</form>