-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_server.php
92 lines (90 loc) · 3.08 KB
/
new_server.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
<?php
$page_title = "New Server";
require 'header.php';
?>
<div class="page-header">
<h1>Add a server</h1>
</div>
<form class="form-horizontal" action="#" id="server_insert">
<div class="control-group">
<label class="control-label" for="inputServerName">Server Name</label>
<div class="controls">
<input type="text" class="input tp" name="inputServerName" id="inputServerName" placeholder="Server Name">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputServerHostname">Server Hostname</label>
<div class="controls">
<input type="text" class="input tp" name="inputServerHostname" id="inputServerHostname" placeholder="Server Hostname">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputServerIP">Server IP Address</label>
<div class="controls">
<input type="text" class="input tp" name="inputServerIP" id="inputServerIP" placeholder="Server IP Address">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputRemoteKey">Remote Key</label>
<div class="controls">
<input type="text" class="input tp" name="inputRemoteKey" id="inputRemoteKey" placeholder="Remote Key">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputRootPassword">Root Password</label>
<div class="controls">
<input type="text" class="input tp" name="inputRootPassword" id="inputRootPassword" placeholder="Root Password">
</div>
</div>
<div class="form-actions">
<div class="controls submit">
<button type="submit" class="btn btn-primary loadingbtn" id="submitbutton">Create Server</button>
</div>
</div>
</form>
<?php
$script = "
<script type='text/javascript'>
$('#server_insert').validate({
rules: {
inputServerName: {required: true, maxlength: 255},
inputServerHostname: {required: true, maxlength: 255},
inputServerIP: {
required: true,
maxlength: 15,
remote: 'scripts/check_server.php'
},
inputRemoteKey: {required: true},
inputRootPassword: {required: true, maxlength: 255}
},
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
success: function(label) {
label
.addClass('valid')
.closest('.control-group').addClass('success');
},
messages: {
inputServerIP:{
remote: 'Server IP already in database.'
}
},
submitHandler: function(form) {
$('.loadingbtn').button('loading');
servercreatefunct();
}
});
function servercreatefunct() {
$.ajax({
type: \"POST\",
url: \"scripts/server_insert.php\",
data: {inputServerName: document.getElementById(\"inputServerName\").value, inputServerHostname: document.getElementById(\"inputServerHostname\").value, inputServerIP: document.getElementById(\"inputServerIP\").value, inputRemoteKey: document.getElementById(\"inputRemoteKey\").value, inputRootPassword: document.getElementById(\"inputRootPassword\").value},
success: function(response){
$('#server_insert').html(response)
}
});
}
</script>";
require 'footer.php';
?>