forked from moiplabs/moip-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnasp.dbconfig.php
110 lines (100 loc) · 3.46 KB
/
nasp.dbconfig.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
<?php
/**
* Template to make tha NASP configuration more easy
*
* @author Alê Borba <[email protected]>
* @version 0.0.1
* @license <a href="http://www.opensource.org/licenses/bsd-license.php">BSD License</a>
*/
//Get the flag sended via $_GET
$infos = isset ($_GET['config']) && $_GET['config'] == true ? $_GET['config'] : false;
if ($infos) {
include_once 'autoload.inc.php';
//Get the informations sended via $_POST
$hostname = isset ($_POST['dbhost']) ? $_POST['dbhost'] : null;
$database = isset ($_POST['dbname']) ? $_POST['dbname'] : null;
$user = isset ($_POST['dbuser']) ? $_POST['dbuser'] : null;
$pass = isset ($_POST['dbpass']) ? $_POST['dbpass'] : null;
$nasp = new MoIPNASP();
$nasp->setDatabase($hostname,$database,$user,$pass);
$nasp->createTable();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NASP's Database Configuration</title>
<style type="text/css">
.conteudo{
width: 75%;
margin: auto;
margin-top: 100px;
}
.logoMoip{
text-align: center;
}
.titulo{
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.formConfig{
border: solid black 1px;
text-align: center;
width: 350px;
margin: auto;
padding: 30px;
}
.dbinfo{
height: 30px;
}
.dbinfo input{
float: right;
}
.dbinfo label{
float: left;
height: 30px;
}
</style>
</head>
<body>
<div class="conteudo">
<div class="logoMoip">
<img src="http://labs.moip.com.br/forum/images/misc/moip-labs-1.0.png">
</div>
<div class="titulo">
NASP's Database Configuration
</div>
<div class="formConfig">
<form method="POST" id="formConfig" action="nasp.dbconfig.php?config=true">
<div class="dbinfo">
<label for="dbhost">Hostname</label>
<input type="text" id="dbhost" name="dbhost" />
</div>
<div class="dbinfo">
<label for="dbname">Database</label>
<input type="text" id="dbname" name="dbname" />
</div>
<div class="dbinfo">
<label for="dbuser">User</label>
<input type="text" id="dbuser" name="dbuser" />
</div>
<div class="dbinfo">
<label for="dbpass">Password</label>
<input type="password" id="dbpass" name="dbpass" />
</div>
<input type="submit" value="Send"/>
<input type="reset" value="Cancel"/>
</form>
</div>
<?php
if ($infos) {
echo "<div class='titulo'>
<h3>Database configured successfully!!</h3>
</div>";
}
?>
</div>
</body>
</html>