-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinstall.php
executable file
·140 lines (133 loc) · 5.44 KB
/
install.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
if (!defined('pvault_panel')){ die('Not Found');}
define('__ROOT__', dirname(__FILE__));
require_once(__ROOT__.'/inc/product.php');
$first_time = 1;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="<?php echo $product.' - '.$ver;?>">
<meta name="author" content="<?php echo $product.' - '.$ver;?>">
<title><?php echo $product;?> - First time setup</title>
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link href="/css/sb-admin-2.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/vault.css" rel="stylesheet">
<script src="/js/jquery/jquery.min.js"></script>
</head>
<body class="bg-gradient-primary">
<div class="container">
<div class="col d-lg-block bg-install-image"></div>
<div class="col-lg-12">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">First time setup</h1>
</div>
<div id="msg"></div>
<div id="install_form" class="user">
<hr>
<strong>Database Settings:</strong>
<hr>
<div class="form-group">
<label for="dbhost" class="control-label">Database Hostname or IP</label>
<input type="text" class="form-control" id="dbhost">
</div>
<div class="form-group">
<label for="dbuser" class="control-label">Database username</label>
<input type="text" class="form-control" id="dbuser">
</div>
<div class="form-group">
<label for="dbpass" class="control-label">Database password</label>
<input type="text" class="form-control" id="dbpass">
</div>
<div class="form-group">
<label for="dbname" class="control-label">Database name</label>
<input type="text" class="form-control" id="dbname">
</div>
<hr>
<strong>User Settings:</strong>
<hr>
<div class="form-group">
<label for="fullName" class="control-label">Full name</label>
<input type="text" class="form-control" id="fullName">
</div>
<div class="form-group">
<label for="email" class="control-label">Email</label>
<input type="text" class="form-control" id="email">
</div>
<div class="form-group">
<label for="password" class="control-label">Password</label>
<div class="col-md-auto password-input-container">
<input name="password" type="password" id="password" class="form-control password-input" value="">
<i class="toggle-password fa fa-eye"></i>
</div>
</div>
<div class="form-group"></div>
<hr>
<button name="save" id="saveInstallData" class="btn btn-primary btn-user btn-block">
Save
</button>
<p> </p>
<p>*All fields required</p>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function() {
$(".toggle-password").click(function () {
var passwordInput = $($(this).siblings(".password-input"));
var icon = $(this);
if (passwordInput.attr("type") == "password") {
passwordInput.attr("type", "text");
icon.removeClass("fa-eye").addClass("fa-eye-slash");
} else {
passwordInput.attr("type", "password");
icon.removeClass("fa-eye-slash").addClass("fa-eye");
}
});
$('#install_form').on('click', '[id*=saveInstallData]', function () {
$('#saveInstallData').prop('disabled', true);
$('#msg').html('<div class="alert alert-info mx-2"><img src="/img/loading.gif"/>Please wait, configuring the system...<p><strong>Please do not close, refresh or navigate away from this page. You will be automatically redirected upon a succesfull installation.</strong></p></div>');
$("#install_form").hide();
$.ajax({
url: '/core/configureSystem.php',
type: 'POST',
data: {
action: 'install',
dbhost: $("#dbhost").val(),
dbuser: $("#dbuser").val(),
dbpass: $("#dbpass").val(),
dbname: $("#dbname").val(),
fullName: $("#fullName").val(),
email: $("#email").val(),
password: $("#password").val(),
},
dataType: 'json',
success: function (data) {
if (data.success) {
window.location = '/';
}
if (data.error) {
var msg = '<div class="alert alert-danger"><i class="fa-solid fa-triangle-exclamation mx-2"></i>' + data.error + '</div>';
$('#msg').html(msg);
$("#install_form").show();
$('#saveInstallData').prop('disabled', false);
}
},
error: function (xhr, status, error) {
var msg = '<div class="alert alert-danger"><i class="fa-solid fa-triangle-exclamation mx-2"></i>' + error + '</div>';
$('#msg').html(msg);
$("#install_form").show();
$('#saveInstallData').prop('disabled', false);
}
});
});
});
</script>