babbascriptinstaller-v20

Gesponsorde koppelingen

PHP script bestanden

  1. babbascriptinstaller-v20

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?php
/*

************************************************************************
* babbaScriptInstaller v2.0                                            *
* Auteur: Sjoert de Boer                                               *
* E-mail: [email protected]                                        *
************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or    *
* (at your option) any later version. For full license see:            *
* http://www.gnu.org/licenses/gpl.txt                                  *
************************************************************************

*/

// Main Configuration //////////////////////////////////////////////////


$scriptname = "My Script";

$license = "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For full license see: http://www.gnu.org/licenses/gpl.txt";

// Query's /////////////////////////////////////////////////////////////

$query[0] = "
    CREATE TABLE `test` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `test` TEXT NOT NULL
    ) TYPE = MYISAM ;
"
;

$query[1] = "
    INSERT INTO `test` ( `id` , `test` )
    VALUES (
    NULL , 'Test'
    );
"
;

// Design //////////////////////////////////////////////////////////////

$css = "

.maintable {
    font-family : Tahoma, Helvetica, Sans-Serif;
    font-size : 11px;
    cursor : default;
    width : 500px;
}
.tab1 {
    width : 33%;
    padding : 3px;
    border-bottom : 1px solid #808080;
    border-top : 1px solid #C0C0C0;
    border-left : 1px solid #C0C0C0;
}
.tab2 {
    width : 34%;
    padding : 3px;
    color : #000000;
    background-color : #EFEFEF;
    border-top : 1px solid #808080;
    border-left : 1px solid #808080;
    border-right : 1px solid #808080;
}
.tab3 {
    width : 33%;
    padding : 3px;
    border-bottom : 1px solid #808080;
    border-top : 1px solid #C0C0C0;
    border-right : 1px solid #C0C0C0;
}
.main {
    padding : 10px;
    color : #000000;
    background-color : #EFEFEF;
    border-bottom : 1px solid #808080;
    border-left : 1px solid #808080;
    border-right : 1px solid #808080;
}
.title {
    font-weight : bold;
}
.formleft {
    width : 25%;
}
.formright {
    width : 75%;
}
.inputfield {
    font-family : Tahoma, Helvetica, Sans-Serif;
    font-size : 11px;
    border : 1px solid #808080;
    padding : 2px;
}
.textarea {
    font-family : Tahoma, Helvetica, Sans-Serif;
    font-size : 11px;
    border : 1px solid #808080;
    padding : 2px;
    width : 98%;
    height : 100px;
}
.button {
    font-family : Tahoma, Helvetica, Sans-Serif;
    font-size : 11px;
    font-weight : bold;
    border : 1px solid #808080;
    padding : 2px;
}
.agree {
    width : 100%;
}

"
;

// No need to configure below this line ////////////////////////////////

if (!isset($_GET["task"])) {
    $_GET["task"] = "license";
}


if ($_GET["task"]=="license") {
// Start Step 1 xHTML-code /////////////////////////////////////////////
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $scriptname; ?> Installation</title>
<?php echo "<style type=\"text/css\">\n".$css."\n</style>"; ?>
</head>
<body>
<form id="mainform" action="<?php echo $_SERVER["PHP_SELF"]; ?>?task=configure" method="post">
<table cellspacing="0" border="0" class="maintable">
    <tr>
        <td class="tab2">License</td>
        <td class="tab3">Configuration</td>
        <td class="tab3">Installation</td>
    </tr>
    <tr>
        <td class="main" colspan="3">

        <table width="100%">
            <tr>
                <td colspan="2" class="title"><?php echo $scriptname; ?> License</td>
            </tr>
            <tr>
                <td colspan="2"><textarea name="license" class="textarea" cols="50" rows="8"><?php echo $license; ?></textarea></td>
            </tr>
            <tr>
                <td><input type="checkbox" name="agree" /></td>
                <td class="agree">I agree</td>
            </tr>
            <tr>
                <td colspan="2" align="right"><input type="submit" name="nextbutton" class="button" value="Next " /></td>
            </tr>
        </table>

        </td>
    </tr>
</table>
</form>
</body>
</html>
<?php
// End Step 1 xHTML-code ///////////////////////////////////////////////
}
elseif ($_GET["task"]=="configure") {

// Start Step 2 xHTML-code /////////////////////////////////////////////
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $scriptname; ?> Installation</title>
<?php echo "<style type=\"text/css\">\n".$css."\n</style>"; ?>
</head>
<body>
<form id="mainform" action="<?php echo $_SERVER["PHP_SELF"]; ?>?task=installation" method="post">
<table cellspacing="0" border="0" class="maintable">
    <tr>
        <td class="tab1">License</td>
        <td class="tab2">Configuration</td>
        <td class="tab3">Installation</td>
    </tr>
    <tr>
        <td class="main" colspan="3">

        <?php
        if(!isset($_POST["agree"])) {
            echo "You must agree with the license to use this software.";
        }

        elseif ($_POST["agree"]=="on") {
        ?>

        <table width="100%">
            <tr>
                <td colspan="2" class="title"><?php echo $scriptname; ?> Configuration</td>
            </tr>
            <tr>
                <td class="formleft">Hostname:</td>
                <td class="formright"><input type="text" name="hostname" class="inputfield" value="localhost" /></td>
            </tr>
            <tr>
                <td class="formleft">MySQL username:</td>
                <td class="formright"><input type="text" name="username" class="inputfield" /></td>
            </tr>
            <tr>
                <td class="formleft">MySQL password:</td>
                <td class="formright"><input type="password" name="password" class="inputfield" /></td>
            </tr>
            <tr>
                <td class="formleft">MySQL database:</td>
                <td class="formright"><input type="text" name="database" class="inputfield" /></td>
            </tr>
            <tr>
                <td colspan="2" align="right"><input type="submit" name="nextbutton" class="button" value="Next " /></td>
            </tr>
        </table>
        <?php
        }
        ?>


        </td>
    </tr>
</table>
</form>
</body>
</html>
<?php
// End Step 2 xHTML-code ///////////////////////////////////////////////
}
elseif ($_GET["task"]=="installation") {

// Start Step 3 xHTML-code /////////////////////////////////////////////
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $scriptname; ?> Installation</title>
<?php echo "<style type=\"text/css\">\n".$css."\n</style>"; ?>
</head>
<body>
<table cellspacing="0" border="0" class="maintable">
    <tr>
        <td class="tab1">License</td>
        <td class="tab1">Configuration</td>
        <td class="tab2">Installation</td>
    </tr>
    <tr>
        <td class="main" colspan="3">
        <?php
        error_reporting(E_ALL ^ E_WARNING);
        if ($_POST["hostname"]=="" OR $_POST["username"]=="" OR $_POST["password"]=="" OR $_POST["database"]=="") {
            if ($_POST["hostname"]=="") {
            echo "<b>Error:</b> Hostname is not set.<br />\n";
            }

            if ($_POST["username"]=="") {
            echo "<b>Error:</b> MySQL username is not set.<br />\n";
            }

            if ($_POST["password"]=="") {
            echo "<b>Error:</b> MySQL password is not set.<br />\n";
            }

            if ($_POST["database"]=="") {
            echo "<b>Error:</b> MySQL database is not set.<br />\n";
            }
        }

        else {
            if(!$mysql = mysql_connect($_POST["hostname"],$_POST["username"],$_POST["password"])) {
            echo "<b>Error:</b> ".mysql_error();
            }

            elseif(!mysql_select_db($_POST["database"],$mysql)) {
            echo "<b>Error:</b> ".mysql_error();
            }

            else {
                    $numberofquerys = count($query)-1;
                    for ($i = 0; $i <= $numberofquerys; $i++) {
                        if (mysql_query($query[$i])) {
                        echo "<b>MySQL query ".$i."</b>: Succes!<br />\n";
                        }

                        else {
                        echo "<b>MySQL query ".$i."</b>: Error: ".mysql_error()."<br />\n";
                        }
                    }
            }
        }

        ?>

        </td>
    </tr>
</table>
</body>
</html>
<?php
// End Step 3 xHTML-code ///////////////////////////////////////////////
}
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.