maak-beheer-pagina
///////////////////////////////////////////////////////////////
/////////////////////// index.php ///////////////////////////
///////////////////////////////////////////////////////////////
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?
if($_POST['maak']){
echo "<script language='JavaScript'> document.location = 'index2.php?f=".$HTTP_POST_VARS['velden']."'; </script>";
} else {
echo "<form method='post' target='_self'>";
echo "Aantal velden <input type='text' name='velden'><br>";
echo "<input type='submit' name='maak' value='Naar stap 2'>";
echo "</form>";
}
?>
if($_POST['maak']){
echo "<script language='JavaScript'> document.location = 'index2.php?f=".$HTTP_POST_VARS['velden']."'; </script>";
} else {
echo "<form method='post' target='_self'>";
echo "Aantal velden <input type='text' name='velden'><br>";
echo "<input type='submit' name='maak' value='Naar stap 2'>";
echo "</form>";
}
?>
///////////////////////////////////////////////////////////////
/////////////////////// index2.php //////////////////////////
///////////////////////////////////////////////////////////////
<textarea cols='100' rows='30'>
<html>
<head>
<style type='text/css'>
body {
background-image: url('doc/background.gif');
background-color: #FFFFFF;
color: #000000;
}
A {
color: #000000;
text-decoration:none;
}
A:hover {
color: #000000;
text-decoration:none;
}
A:active{
color: #000000;
text-decoration:none;
}
A:visited{
color: #000000;
text-decoration:none;
}
table { font-size: 10px; font-family: Verdana, Arial; }
td.main {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 1;
border-left-width: 1;
border-right-width: 1;
border-bottom-width: 1;
}
td.none {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 0;
border-left-width: 0;
border-right-width: 0;
border-bottom-width: 0;
}
td.main_r {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 1;
border-left-width: 0;
border-right-width: 1;
border-bottom-width: 1;
}
hr {
background-color:#000000;
color: #000000;
border-style: solid;
border-width: 0px;
border-color:#000000;
background-image: none;
height: 1pt;
}
</style>
</head>
<body>
<table><tr><td>
<?
$host = ;
$user = ;
$ww = ;
$db = ;
mysql_connect("$host","$user","$ww");
mysql_select_db("$db")or die (mysql_error());
function afkorten($string, $lenght, $end = '<font color=red>...</font>')
{
if (strlen($string) > $lenght)
{
$lenght -= strlen($end);
$last = strrpos(substr($string, 0, $lenght + 1), ' ');
return substr($string, 0, (!$last)? $lenght: $last) . $end;
}
return $string;
}
$functie = $_GET['f'];
if($functie == ""){ $functie = "b"; }
if($functie == "b"){
echo "<hr>";
echo "Bekijken";
echo "<hr>";
echo "<table width='100%' cellspacing='5'>";
echo "<tr>";
echo "<td class='none'><b>ID</b></td>";
echo "<td class='none'><b></b></td>";
Code (php)
echo "<td class='none'><b>Verwijderen</b></td>";
echo "<td class='none'><b>Wijzigen</b></td>";
$select = mysql_query("SELECT * FROM ORDER BY DESC") or die(mysql_error());
$select = mysql_query("SELECT * FROM ORDER BY ") or die(mysql_error());
while($row = mysql_fetch_array($select)){
echo "<tr>";
echo "<td class='none'>".$row['id']."</td>";
echo "<td class='none'>".afkorten($row[''],'')."</td>";
echo "<td class='none' align='right'><a href='?f=v&fid=".$row['id']."'><font color='red'><b>V</b></font></a></td>";
echo "<td class='none' align='right'><a href='?f=w&fid=".$row['id']."'><font color='darkorange'><b>W</b></font></a></td>";
echo "</tr>";
}
echo "</table>";
echo "<hr>";
echo "<a href='?f=t'>Voeg een record toe</a>";
echo "<hr>";
} else if($functie == "v"){
$verwijder_id = $_GET['fid'];
$delete = mysql_query("DELETE FROM WHERE id = '$verwijder_id'") or die(mysql_error());
echo "Record #".$verwijder_id." is verwijderd.<br>";
echo "<script language='JavaScript'> document.location = ''; </script>";
echo "<a href=''>Terug</a>";
} else if($functie == "t"){
if($_POST['toevoegen']){
$ = $HTTP_POST_VARS[''];
$toevoegen = "INSERT INTO (
Code (php)
) VALUES (
Code (php)
)";
mysql_query($toevoegen) or die(mysql_error());
echo "Record is toegevoegd.<br>";
echo "<script language='JavaScript'> document.location = ''; </script>";
echo "<a href=''>Terug</a>";
} else {
echo "<hr>";
echo "<b>Voeg een record toe</b>:";
echo "<hr>";
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b></b></td>";
echo "<td class='none'>";
Code (php)
1
2
2
<? $type_teller = "type_".$teller;
if($HTTP_POST_VARS[$type_teller] == "textarea"){ ?>
if($HTTP_POST_VARS[$type_teller] == "textarea"){ ?>
echo "<textarea cols='30' rows='7' name=''></textarea>";
echo "<input type='text' name=''>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='toevoegen' value='Voeg record toe'><br>";
echo "<a href=''>Terug</a></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
} else if($functie == "w"){
$wijzig_id = $_GET['fid'];
if($_POST['wijzigen']){
$ = $HTTP_POST_VARS[''];
$wijzigen = mysql_query("UPDATE SET
Code (php)
WHERE id = '$wijzig_id' LIMIT 1") or die(mysql_error());
echo "Record is gewijzigd.<br>";
echo "<script language='JavaScript'> document.location = ''; </script>";
echo "<a href=''>Terug</a>";
} else {
echo "<hr>";
echo "<b>Wijzig een record</b>:";
echo "<hr>";
$record_select = mysql_query("SELECT * FROM WHERE id = '$wijzig_id' LIMIT 1");
while($row = mysql_fetch_array($record_select)){
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b></b></td>";
echo "<td class='none'>";
Code (php)
1
2
2
<? $type_teller = "type_".$teller;
if($HTTP_POST_VARS[$type_teller] == "textarea"){ ?>
if($HTTP_POST_VARS[$type_teller] == "textarea"){ ?>
echo "<textarea name='' cols='30' rows='7'>".$row['']."</textarea>";
echo "<input type='text' name='' value='".$row['']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='wijzigen' value='Wijzig dit record'></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
}
}
?>
</td></tr></table>
</body>
</html>
</textarea>
Code (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
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
<?
} else {
$fields = $_GET['f'];
$teller = 1;
echo "<form method='post' target='_self'>";
echo "Tabel <input type='text' name='tabel'><br>";
echo " <br>";
echo "Host <input type='text' name='host' value='localhost'><br>";
echo "DB - naam <input type='text' name='db'><br>";
echo "Gebruiker <input type='text' name='user'><br>";
echo "Wachtwoord <input type='password' name='pass'><br>";
echo " <br>";
echo "Url pagina <input type='text' name='p_url' value='index.php'><br>";
echo " <br>";
echo "Maximale lengte te weergeven text <input type='text' name='afkorten' value='125'><br>";
echo " <br>";
echo "Na toevoegen direct terug (anders eerst melding) <input type='checkbox' name='terug' value='1'><br>";
echo " <br>";
echo "Sorteren omdraaien <input type='checkbox' value='1' name='desk'><br>";
echo " <br>";
echo "<table>";
echo "<tr>";
echo "<td><b>#</b></td>";
echo "<td><b>Naam</b></td>";
echo "<td><b>Sorteer</b></td>";
echo "<td><b>Type</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td>-</td>";
echo "<td>ID</td>";
echo "<td><input type='radio' name='sorteer' value='0' CHECKED></td>";
echo "<td>-</td>";
echo "</tr>";
while($teller <= $fields){
echo "<tr>";
echo "<td>".$teller."</td>";
echo "<td><input type='text' name='".$teller."'></td>";
echo "<td><input type='radio' name='sorteer' value='".$teller."'></td>";
echo "<td>";
echo "<input type='radio' name='type_".$teller."' value='input' CHECKED>Input ";
echo "<input type='radio' name='type_".$teller."' value='textarea'>Textarea";
echo "</td>";
echo "</tr>";
$teller ++;
}
echo "</table>";
echo " <br>";
echo "<input type='submit' name='maak' value='Maak pagina'>";
echo "</form>";
}
?>
} else {
$fields = $_GET['f'];
$teller = 1;
echo "<form method='post' target='_self'>";
echo "Tabel <input type='text' name='tabel'><br>";
echo " <br>";
echo "Host <input type='text' name='host' value='localhost'><br>";
echo "DB - naam <input type='text' name='db'><br>";
echo "Gebruiker <input type='text' name='user'><br>";
echo "Wachtwoord <input type='password' name='pass'><br>";
echo " <br>";
echo "Url pagina <input type='text' name='p_url' value='index.php'><br>";
echo " <br>";
echo "Maximale lengte te weergeven text <input type='text' name='afkorten' value='125'><br>";
echo " <br>";
echo "Na toevoegen direct terug (anders eerst melding) <input type='checkbox' name='terug' value='1'><br>";
echo " <br>";
echo "Sorteren omdraaien <input type='checkbox' value='1' name='desk'><br>";
echo " <br>";
echo "<table>";
echo "<tr>";
echo "<td><b>#</b></td>";
echo "<td><b>Naam</b></td>";
echo "<td><b>Sorteer</b></td>";
echo "<td><b>Type</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td>-</td>";
echo "<td>ID</td>";
echo "<td><input type='radio' name='sorteer' value='0' CHECKED></td>";
echo "<td>-</td>";
echo "</tr>";
while($teller <= $fields){
echo "<tr>";
echo "<td>".$teller."</td>";
echo "<td><input type='text' name='".$teller."'></td>";
echo "<td><input type='radio' name='sorteer' value='".$teller."'></td>";
echo "<td>";
echo "<input type='radio' name='type_".$teller."' value='input' CHECKED>Input ";
echo "<input type='radio' name='type_".$teller."' value='textarea'>Textarea";
echo "</td>";
echo "</tr>";
$teller ++;
}
echo "</table>";
echo " <br>";
echo "<input type='submit' name='maak' value='Maak pagina'>";
echo "</form>";
}
?>
///////////////////////////////////////////////////////////////
/////// voorbeeld van een gegenereerde code //////////
///////////////////////////////////////////////////////////////
<html>
<head>
<style type='text/css'>
body {
background-image: url('doc/background.gif');
background-color: #FFFFFF;
color: #000000;
}
A {
color: #000000;
text-decoration:none;
}
A:hover {
color: #000000;
text-decoration:none;
}
A:active{
color: #000000;
text-decoration:none;
}
A:visited{
color: #000000;
text-decoration:none;
}
table { font-size: 10px; font-family: Verdana, Arial; }
td.main {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 1;
border-left-width: 1;
border-right-width: 1;
border-bottom-width: 1;
}
td.none {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 0;
border-left-width: 0;
border-right-width: 0;
border-bottom-width: 0;
}
td.main_r {
background-color: #FFFFFF;
color: #000000;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
border-style: solid;
border-color: #000000;
border-top-width: 1;
border-left-width: 0;
border-right-width: 1;
border-bottom-width: 1;
}
hr {
background-color:#000000;
color: #000000;
border-style: solid;
border-width: 0px;
border-color:#000000;
background-image: none;
height: 1pt;
}
</style>
</head>
<body>
<table><tr><td>
Code (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
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
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
<?
$host = localhost;
$user = netersel_koen;
$ww = koen;
$db = netersel_koen;
mysql_connect("$host","$user","$ww");
mysql_select_db("$db")or die (mysql_error());
function afkorten($string, $lenght, $end = '<font color=red>...</font>')
{
if (strlen($string) > $lenght)
{
$lenght -= strlen($end);
$last = strrpos(substr($string, 0, $lenght + 1), ' ');
return substr($string, 0, (!$last)? $lenght: $last) . $end;
}
return $string;
}
$functie = $_GET['f'];
if($functie == ""){ $functie = "b"; }
if($functie == "b"){
echo "<hr>";
echo "Bekijken";
echo "<hr>";
echo "<table width='100%' cellspacing='5'>";
echo "<tr>";
echo "<td class='none'><b>ID</b></td>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'><b>Verwijderen</b></td>";
echo "<td class='none'><b>Wijzigen</b></td>";
$select = mysql_query("SELECT * FROM domeininfo ORDER BY id DESC") or die(mysql_error());
while($row = mysql_fetch_array($select)){
echo "<tr>";
echo "<td class='none'>".$row['id']."</td>";
echo "<td class='none'>".afkorten($row['type'],'125')."</td>";
echo "<td class='none'>".afkorten($row['naam'],'125')."</td>";
echo "<td class='none'>".afkorten($row['url'],'125')."</td>";
echo "<td class='none'>".afkorten($row['info'],'125')."</td>";
echo "<td class='none' align='right'><a href='test.php?f=v&fid=".$row['id']."'><font color='red'><b>V</b></font></a></td>";
echo "<td class='none' align='right'><a href='test.php?f=w&fid=".$row['id']."'><font color='darkorange'><b>W</b></font></a></td>";
echo "</tr>";
}
echo "</table>";
echo "<hr>";
echo "<a href='test.php?f=t'>Voeg een record toe</a>";
echo "<hr>";
} else if($functie == "v"){
$verwijder_id = $_GET['fid'];
$delete = mysql_query("DELETE FROM domeininfo WHERE id = '$verwijder_id'") or die(mysql_error());
echo "Record #".$verwijder_id." is verwijderd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else if($functie == "t"){
if($_POST['toevoegen']){
$type = $HTTP_POST_VARS['type'];
$naam = $HTTP_POST_VARS['naam'];
$url = $HTTP_POST_VARS['url'];
$info = $HTTP_POST_VARS['info'];
$toevoegen = "INSERT INTO domeininfo (
type,naam,url,info
) VALUES (
'$type','$naam','$url','$info'
)";
mysql_query($toevoegen) or die(mysql_error());
echo "Record is toegevoegd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else {
echo "<hr>";
echo "<b>Voeg een record toe</b>:";
echo "<hr>";
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='type'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='naam'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='url'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'>";
echo "<textarea cols='30' rows='7' name='info'></textarea>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='toevoegen' value='Voeg record toe'><br>";
echo "<a href='test.php'>Terug</a></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
} else if($functie == "w"){
$wijzig_id = $_GET['fid'];
if($_POST['wijzigen']){
$type = $HTTP_POST_VARS['type'];
$naam = $HTTP_POST_VARS['naam'];
$url = $HTTP_POST_VARS['url'];
$info = $HTTP_POST_VARS['info'];
$wijzigen = mysql_query("UPDATE domeininfo SET
type = '$type' , naam = '$naam' , url = '$url' , info = '$info'
WHERE id = '$wijzig_id' LIMIT 1") or die(mysql_error());
echo "Record is gewijzigd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else {
echo "<hr>";
echo "<b>Wijzig een record</b>:";
echo "<hr>";
$record_select = mysql_query("SELECT * FROM domeininfo WHERE id = '$wijzig_id' LIMIT 1");
while($row = mysql_fetch_array($record_select)){
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='type' value='".$row['type']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='naam' value='".$row['naam']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='url' value='".$row['url']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'>";
echo "<textarea name='info' cols='30' rows='7'>".$row['info']."</textarea>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='wijzigen' value='Wijzig dit record'></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
}
}
?>
$host = localhost;
$user = netersel_koen;
$ww = koen;
$db = netersel_koen;
mysql_connect("$host","$user","$ww");
mysql_select_db("$db")or die (mysql_error());
function afkorten($string, $lenght, $end = '<font color=red>...</font>')
{
if (strlen($string) > $lenght)
{
$lenght -= strlen($end);
$last = strrpos(substr($string, 0, $lenght + 1), ' ');
return substr($string, 0, (!$last)? $lenght: $last) . $end;
}
return $string;
}
$functie = $_GET['f'];
if($functie == ""){ $functie = "b"; }
if($functie == "b"){
echo "<hr>";
echo "Bekijken";
echo "<hr>";
echo "<table width='100%' cellspacing='5'>";
echo "<tr>";
echo "<td class='none'><b>ID</b></td>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'><b>Verwijderen</b></td>";
echo "<td class='none'><b>Wijzigen</b></td>";
$select = mysql_query("SELECT * FROM domeininfo ORDER BY id DESC") or die(mysql_error());
while($row = mysql_fetch_array($select)){
echo "<tr>";
echo "<td class='none'>".$row['id']."</td>";
echo "<td class='none'>".afkorten($row['type'],'125')."</td>";
echo "<td class='none'>".afkorten($row['naam'],'125')."</td>";
echo "<td class='none'>".afkorten($row['url'],'125')."</td>";
echo "<td class='none'>".afkorten($row['info'],'125')."</td>";
echo "<td class='none' align='right'><a href='test.php?f=v&fid=".$row['id']."'><font color='red'><b>V</b></font></a></td>";
echo "<td class='none' align='right'><a href='test.php?f=w&fid=".$row['id']."'><font color='darkorange'><b>W</b></font></a></td>";
echo "</tr>";
}
echo "</table>";
echo "<hr>";
echo "<a href='test.php?f=t'>Voeg een record toe</a>";
echo "<hr>";
} else if($functie == "v"){
$verwijder_id = $_GET['fid'];
$delete = mysql_query("DELETE FROM domeininfo WHERE id = '$verwijder_id'") or die(mysql_error());
echo "Record #".$verwijder_id." is verwijderd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else if($functie == "t"){
if($_POST['toevoegen']){
$type = $HTTP_POST_VARS['type'];
$naam = $HTTP_POST_VARS['naam'];
$url = $HTTP_POST_VARS['url'];
$info = $HTTP_POST_VARS['info'];
$toevoegen = "INSERT INTO domeininfo (
type,naam,url,info
) VALUES (
'$type','$naam','$url','$info'
)";
mysql_query($toevoegen) or die(mysql_error());
echo "Record is toegevoegd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else {
echo "<hr>";
echo "<b>Voeg een record toe</b>:";
echo "<hr>";
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='type'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='naam'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='url'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'>";
echo "<textarea cols='30' rows='7' name='info'></textarea>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='toevoegen' value='Voeg record toe'><br>";
echo "<a href='test.php'>Terug</a></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
} else if($functie == "w"){
$wijzig_id = $_GET['fid'];
if($_POST['wijzigen']){
$type = $HTTP_POST_VARS['type'];
$naam = $HTTP_POST_VARS['naam'];
$url = $HTTP_POST_VARS['url'];
$info = $HTTP_POST_VARS['info'];
$wijzigen = mysql_query("UPDATE domeininfo SET
type = '$type' , naam = '$naam' , url = '$url' , info = '$info'
WHERE id = '$wijzig_id' LIMIT 1") or die(mysql_error());
echo "Record is gewijzigd.<br>";
echo "<script language='JavaScript'> document.location = 'test.php'; </script>";
} else {
echo "<hr>";
echo "<b>Wijzig een record</b>:";
echo "<hr>";
$record_select = mysql_query("SELECT * FROM domeininfo WHERE id = '$wijzig_id' LIMIT 1");
while($row = mysql_fetch_array($record_select)){
echo "<form method='post' target='_self'>";
echo "<table>";
echo "<tr>";
echo "<td class='none'><b>type</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='type' value='".$row['type']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>naam</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='naam' value='".$row['naam']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>url</b></td>";
echo "<td class='none'>";
echo "<input type='text' name='url' value='".$row['url']."'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><b>info</b></td>";
echo "<td class='none'>";
echo "<textarea name='info' cols='30' rows='7'>".$row['info']."</textarea>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='none'><input type='submit' name='wijzigen' value='Wijzig dit record'></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
}
}
?>
</td></tr></table>
</body>
</html>