hulp met formulier
alles werkt nu, ik ben door jullie commentaar op het juiste spoor gezet. Bedankt hiervoor.
Zijn er nog overige aanpassingen die bijv uit beveiligings oogpunt beter kunnen? ect.....
*update
heb het inmiddels weer werkend met e-mail en captcha code.
nu lukt het me alleen niet om de "succes verzonden" melding rechts onderin te zetten.
mooier is denk ik op een andere pagina waarna je door kunt gaan naar de main page.
----------------------------------------------------------
Ik had dit formulier nog staan tussen m'n test files. echter krijg ik het niet meer aan de praat.
Ik mis het e-mail adres waar het naartoe gezonden wordt
en de captcha code werkt niet.
Wie kan mij helpen?
de test url:
http://www.modelbouwlocaties.nl/contact-form/contact-form-3.php
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
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php
$contact_form_field_subject = 'Onderwerp:';
$contact_form_field_location = 'Locatie:';
$contact_form_field_name = 'Naam locatie:';
$contact_form_field_adres = 'Adres:';
$contact_form_field_postcode = 'Postcode:';
$contact_form_field_city = 'Plaats:';
$contact_form_field_url = 'Website:';
$contact_form_field_tel = 'Telefoon:';
$contact_form_field_lat = 'Lat:';
$contact_form_field_lon = 'Lon:';
$contact_form_field_email = 'Uw e-mailadres:';
$contact_form_field_emailname = 'Uw naam:';
$contact_form_field_message = 'Opmerking:';
$contact_form_field_number = 'Validatie nummer:';
$contact_form_field_prompt = 'Validatie nummer';
$contact_form_field_formname = 'Contactformulier';
$contact_form_button = 'Verstuur';
$contact_form_sent = 'Het bericht is met succes verzonden';
$contact_form_not_sent = 'Het bericht is niet verzonden';
$contact_form_invalid_data = 'Vul alle "rood" verplichte velden in.';
?>
<div class="contact_form">
<?php
function contact_form_post($name)
{
return isset($_POST[$name]) ? htmlentities($_POST[$name], ENT_COMPAT) : '';
}
if (isset($_POST['Contact']))
{
if (get_magic_quotes_gpc() && !function_exists('strip_slashes_deep'))
{
function strip_slashes_deep($value)
{
if (is_array($value)) return array_map('strip_slashes_deep', $value);
return stripslashes($value);
}
$_GET = strip_slashes_deep($_GET);
$_POST = strip_slashes_deep($_POST);
$_COOKIE = strip_slashes_deep($_COOKIE);
}
$patern_aux1 = "(\\w+(-\\w+)*)";
$patern_aux2 = "($patern_aux1\\.)*$patern_aux1@($patern_aux1\\.)+$patern_aux1";
$valid_subject = isset($_POST['Subject']) && trim($_POST['Subject']);
$valid_location = isset($_POST['Location' ]) && trim($_POST['Location']);
$valid_name = isset($_POST['Name' ]) && trim($_POST['Name']);
$valid_adres = isset($_POST['Adres' ]) && trim($_POST['Adres']);
$valid_postcode = isset($_POST['Postcode' ]) && trim($_POST['Postcode']);
$valid_city = isset($_POST['City']) && trim($_POST['City']);
$valid_url = isset($_POST['Url']) && trim($_POST['Url']);
$valid_tel = isset($_POST['Tel']) && trim($_POST['Tel']);
$valid_emailname = isset($_POST['Emailname' ]) && trim($_POST['Emailname']);
$valid_email = isset($_POST['Email' ]) && preg_match("/^$patern_aux2$/iX", $_POST['Email']);
$valid_message = isset($_POST['Message']) && trim($_POST['Message']);
$valid_number = isset($_POST['Number' ]) && isset($_SESSION['Number']) && $_POST['Number'] == $_SESSION['Number'];
// verplichte velden die rood en schuin gezet worden
if (!$valid_subject) $contact_form_field_subject = "<em>$contact_form_field_subject</em>";
if (!$valid_location) $contact_form_field_location = "<em>$contact_form_field_location</em>";
if (!$valid_name) $contact_form_field_name = "<em>$contact_form_field_name</em>";
if (!$valid_adres) $contact_form_field_adres = "<em>$contact_form_field_adres</em>";
//if (!$valid_postcode) $contact_form_field_postcode = "<em>$contact_form_field_postcode</em>";
if (!$valid_city) $contact_form_field_city = "<em>$contact_form_field_city</em>";
//if (!$valid_url) $contact_form_field_url = "<em>$contact_form_field_url</em>";
//if (!$valid_tel) $contact_form_field_tel = "<em>$contact_form_field_tel</em>";
if (!$valid_emailname)$contact_form_field_emailname = "<em>$contact_form_field_emailname</em>";
if (!$valid_email) $contact_form_field_email = "<em>$contact_form_field_email</em>";
//if (!$valid_message) $contact_form_field_message = "<em>$contact_form_field_message</em>";
if (!$valid_number) $contact_form_field_number = "<em>$contact_form_field_number</em>";
// verplichte velden die ingevuld moeten worden
if ($valid_location &&
$valid_name &&
$valid_adres &&
//$valid_postcode &&
$valid_city &&
//$valid_url &&
//$valid_tel &&
$valid_email &&
$valid_emailname &&
//$valid_message &&
$valid_subject &&
$valid_number)
{
$error_reporting = error_reporting(E_ERROR | E_PARSE);
// volgorde zoals het in de e-mail komt te staan
$tekst .= "Locatie: $_POST[Location]\r\n";
$tekst .= "Naam locatie: $_POST[Name]\r\n";
$tekst .= "Adres: $_POST[Adres]\r\n";
$tekst .= "Postcode: $_POST[Postcode]\r\n";
$tekst .= "Plaats: $_POST[City]\r\n";
$tekst .= "Website: $_POST[Url]\r\n";
$tekst .= "Telefoon: $_POST[Tel]\r\n";
$tekst .= "Lat: $_POST[Lat]\r\n";
$tekst .= "Lon: $_POST[Lon]\r\n";
$tekst .= "Naam: $_POST[Emailname]\r\n";
$tekst .= "E-mail: $_POST[Email]\r\n";
$tekst .= "Opmerking: $_POST[Message]\r\n";
$subject .= "$_POST[Subject]";
$mail_sent = mail($contact_form_your_email, $subject, $tekst,
"To: $contact_form_your_name <$contact_form_your_email>\r\n" .
"From: {$_POST['Name']} <{$_POST['Email']}>\r\n");
error_reporting($error_reporting);
if ($mail_sent)
echo "<div class=\"error\"><h4>$contact_form_sent</h4></div>";
else echo "<div class=\"error\"><em class=\"error\">$contact_form_not_sent</em></div>";
if ($mail_sent) $_POST = array();
}
else echo "<div class=\"contact_form\"><div class=\"error\"><em>$contact_form_invalid_data</em></div></div>";
}
$_SESSION['Number'] = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT);
?>
<html>
<head>
<script type="text/javascript" language="Javascript" src="http://maps.google.nl/maps?file=api&v=2&key=ABQIAAAAFfkqaO0Jn3KjadwVU2kClRTvQnD7WYhfEkTfU7dDbXSM7xa89xSn6tM7QIDCWQ-96jKBE3toIjzW-w" type="text/javascript"></script>
<script type="text/javascript" language="Javascript">
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + "geen geldig adres gevonden.");
} else {
var map = new GMap2(document.getElementById("map_canvas"));
marker = new GMarker(point, {draggable: true});
map.setCenter(marker.getPoint(), 17);
map.setMapType( G_SATELLITE_MAP );
document.getElementById('lat').value = marker.getPoint().lat().toFixed(6);
document.getElementById('lon').value = marker.getPoint().lng().toFixed(6);
GEvent.addListener(marker, "click", function() {
var point = marker.getPoint();
var lat = document.getElementById('lat').value;
var lon = document.getElementById('lon').value;
var naam = document.getElementById('naam').value;
var adres = document.getElementById('adres').value;
var postcode = document.getElementById('postcode').value;
var plaats = document.getElementById('plaats').value;
var url = document.getElementById('url').value;
var telefoon = document.getElementById('telefoon').value;
var land = document.getElementById('land').value;
var html = ("<b>" + naam + "</b><br>" + adres + "<br>" + postcode + "<br>" + plaats + "<br>" + land + "<br><br>" + url + "<br>" + telefoon + "<br>Lat: " + lat + "<br>Lon: " + lon);
marker.openInfoWindowHtml(html);
});
GEvent.addListener(marker, "dragstart", function() {
map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var point = marker.getPoint();
document.getElementById('lat').value = marker.getPoint().lat().toFixed(6);
document.getElementById('lon').value = marker.getPoint().lng().toFixed(6);
});
map.addOverlay(marker);
}
}
);
}
}
</script>
<style type="text/css">
<!--
table { font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
<link rel="stylesheet" href="style-simple.css">
<?php { ?>
<body onLoad="load()" onUnload="GUnload()">
<form name="form" method="post" action="<?=$_SERVER['REQUEST_URI'];?>">
<table width="900">
<tr>
<td colspan="2"><div align="left"><?=$contact_form_field_formname;?></div></td>
</tr>
<tr>
<td width="445"><table width="100%">
<tr>
<th colspan="3"></th>
</tr>
<tr>
<th><?=$contact_form_field_subject;?>*</th>
<td colspan="2">
<p>
<input name="Subject" type="radio" value="toevoeging nieuwe locatie"<?php if ($_POST['Subject'] == 'toevoeging nieuwe locatie') { echo 'checked'; } ?> />
Toevoeging<br />
<input name="Subject" type="radio" value="wijziging locatie"<?php if ($_POST['Subject'] == 'wijziging locatie') { echo 'checked'; } ?> />
Wijziging<br />
<input name="Subject" type="radio" value="verwijdering locatie"<?php if ($_POST['Subject'] == 'verwijdering locatie') { echo 'checked'; } ?> />
Verwijdering
</div></td>
</tr>
<tr>
<th colspan="3">------------------- Locatie informatie -------------------</th>
</tr>
<tr>
<th width="127"><?=$contact_form_field_location; ?>*</th>
<td colspan="2"><div class="input">
<p>
<input name="Location" type="radio" value="green"<?php if ($_POST['Location'] == 'green') { echo 'checked'; } ?> />
Autoclub<br />
<input name="Location" type="radio" value="red"<?php if ($_POST['Location'] == 'red') { echo 'checked'; } ?> />
Vliegclub<br />
<input name="Location" type="radio" value="blue"<?php if ($_POST['Location'] == 'blue') { echo 'checked'; } ?> />
Bootclub<br />
<input name="Location" type="radio" value="gray"<?php if ($_POST['Location'] == 'gray') { echo 'checked'; } ?> />
Winkel </p>
</div></td></tr>
<tr>
<th><?=$contact_form_field_name; ?>*</th><td colspan="2"><div class="input"><input name="Name" id="naam" type="text" value="<?=contact_form_post('Name');?>"></div></td></tr>
<tr>
<th><?=$contact_form_field_adres; ?>*</th><td colspan="2"><div class="input"><input name="Adres" id="adres" type="text" value="<?=contact_form_post('Adres');?>"></div></td></tr>
<tr><th><?=$contact_form_field_postcode; ?></th><td colspan="2"><div class="input"><input name="Postcode" id="postcode" type="text" value="<?=contact_form_post('Postcode');?>" size="10">
</div></td></tr>
<tr>
<th><?=$contact_form_field_city;?>*</th><td colspan="2"><div class="input"><input name="City" id="plaats" type="text" value="<?=contact_form_post('City');?>"></div></td></tr>
<tr><th><?=$contact_form_field_url;?></th><td colspan="2"><div class="input"><input name="Url" id="url" type="text" value="<?=contact_form_post('Url');?>" /></div></td></tr>
<tr><th><?=$contact_form_field_tel;?></th><td colspan="2"><div class="input"><input name="Tel" id="telefoon" type="text" value="<?=contact_form_post('Tel');?>" size="10" />
</div></td></tr>
<tr>
<th colspan="3">------------------- Google informatie -------------------</th>
</tr>
<tr>
<th><?=$contact_form_field_lat;?></th>
<td colspan="2"><div class="input"><input name="Lat" id="lat" type="text" value="<?=contact_form_post('Lat');?>" size="10" readonly="readonly" style="background: #CCCCCC; border: solid 1px; border-color:#999999" /><input name="locatie" type="hidden" value="" size="60" />
</div></td>
</tr>
<tr>
<th><?=$contact_form_field_lon;?></th>
<td colspan="2"><div class="input"><input name="Lon" id="lon" type="text" value="<?=contact_form_post('Lon');?>" size="10" readonly="readonly" style="background: #CCCCCC; border: solid 1px; border-color:#999999"
/><input name="land" type="hidden" id="land" value="Nederland" />
</div></td>
</tr>
<tr>
<th colspan="3">
------------------ Afzender informatie ------------------</th>
</tr>
<tr>
<th><?=$contact_form_field_emailname; ?>*</th>
<td colspan="2"><div class="input"><input name="Emailname" type="text" value="<?=contact_form_post('Emailname');?>"></div></td>
</tr>
<tr>
<th><?=$contact_form_field_email; ?>*</th>
<td colspan="2"><div class="input"><input name= "Email" type="text" value="<?=contact_form_post('Email');?>"></div></td>
</tr>
<tr><th><?=$contact_form_field_message;?></th><td colspan="2"><div class="input"><textarea name="Message" cols="25" rows="4"><?=contact_form_post('Message');?></textarea></div></td></tr>
<tr>
<th><?=$contact_form_field_number;?>*</th><td colspan="2"><div class="input" style="float: left;"><input type="text" name="Number" autocomplete="off">
</div>
</td>
</tr>
<tr>
<th> </th>
<td width="65"><img width="60" height="17" src="<?=$contact_form_image_url;?>?sname=<?=session_name();?>" alt=""></td>
<td width="220"><span class="input" style="float: left;"><small>
<?=$contact_form_field_prompt;?>
</small></span></td>
</tr>
<tr>
<th colspan="3"> </th>
</tr>
<tr><th><input type="button" value="Toon op kaart" onClick="showAddress(this.form.adres.value +', ' + this.form.plaats.value);" /></th><td colspan="2"><input id="submit_contact" class="submit" type="submit" name="Contact" value="<?=$contact_form_button;?>"></td></tr>
</table></td>
<td width="443" valign="top"><div id="map_canvas" style="width: 460px; height: 500px"></div>
<br>
* verplichte velden</td>
</tr>
</table>
</form>
<?php } ?>
</div>
$contact_form_field_subject = 'Onderwerp:';
$contact_form_field_location = 'Locatie:';
$contact_form_field_name = 'Naam locatie:';
$contact_form_field_adres = 'Adres:';
$contact_form_field_postcode = 'Postcode:';
$contact_form_field_city = 'Plaats:';
$contact_form_field_url = 'Website:';
$contact_form_field_tel = 'Telefoon:';
$contact_form_field_lat = 'Lat:';
$contact_form_field_lon = 'Lon:';
$contact_form_field_email = 'Uw e-mailadres:';
$contact_form_field_emailname = 'Uw naam:';
$contact_form_field_message = 'Opmerking:';
$contact_form_field_number = 'Validatie nummer:';
$contact_form_field_prompt = 'Validatie nummer';
$contact_form_field_formname = 'Contactformulier';
$contact_form_button = 'Verstuur';
$contact_form_sent = 'Het bericht is met succes verzonden';
$contact_form_not_sent = 'Het bericht is niet verzonden';
$contact_form_invalid_data = 'Vul alle "rood" verplichte velden in.';
?>
<div class="contact_form">
<?php
function contact_form_post($name)
{
return isset($_POST[$name]) ? htmlentities($_POST[$name], ENT_COMPAT) : '';
}
if (isset($_POST['Contact']))
{
if (get_magic_quotes_gpc() && !function_exists('strip_slashes_deep'))
{
function strip_slashes_deep($value)
{
if (is_array($value)) return array_map('strip_slashes_deep', $value);
return stripslashes($value);
}
$_GET = strip_slashes_deep($_GET);
$_POST = strip_slashes_deep($_POST);
$_COOKIE = strip_slashes_deep($_COOKIE);
}
$patern_aux1 = "(\\w+(-\\w+)*)";
$patern_aux2 = "($patern_aux1\\.)*$patern_aux1@($patern_aux1\\.)+$patern_aux1";
$valid_subject = isset($_POST['Subject']) && trim($_POST['Subject']);
$valid_location = isset($_POST['Location' ]) && trim($_POST['Location']);
$valid_name = isset($_POST['Name' ]) && trim($_POST['Name']);
$valid_adres = isset($_POST['Adres' ]) && trim($_POST['Adres']);
$valid_postcode = isset($_POST['Postcode' ]) && trim($_POST['Postcode']);
$valid_city = isset($_POST['City']) && trim($_POST['City']);
$valid_url = isset($_POST['Url']) && trim($_POST['Url']);
$valid_tel = isset($_POST['Tel']) && trim($_POST['Tel']);
$valid_emailname = isset($_POST['Emailname' ]) && trim($_POST['Emailname']);
$valid_email = isset($_POST['Email' ]) && preg_match("/^$patern_aux2$/iX", $_POST['Email']);
$valid_message = isset($_POST['Message']) && trim($_POST['Message']);
$valid_number = isset($_POST['Number' ]) && isset($_SESSION['Number']) && $_POST['Number'] == $_SESSION['Number'];
// verplichte velden die rood en schuin gezet worden
if (!$valid_subject) $contact_form_field_subject = "<em>$contact_form_field_subject</em>";
if (!$valid_location) $contact_form_field_location = "<em>$contact_form_field_location</em>";
if (!$valid_name) $contact_form_field_name = "<em>$contact_form_field_name</em>";
if (!$valid_adres) $contact_form_field_adres = "<em>$contact_form_field_adres</em>";
//if (!$valid_postcode) $contact_form_field_postcode = "<em>$contact_form_field_postcode</em>";
if (!$valid_city) $contact_form_field_city = "<em>$contact_form_field_city</em>";
//if (!$valid_url) $contact_form_field_url = "<em>$contact_form_field_url</em>";
//if (!$valid_tel) $contact_form_field_tel = "<em>$contact_form_field_tel</em>";
if (!$valid_emailname)$contact_form_field_emailname = "<em>$contact_form_field_emailname</em>";
if (!$valid_email) $contact_form_field_email = "<em>$contact_form_field_email</em>";
//if (!$valid_message) $contact_form_field_message = "<em>$contact_form_field_message</em>";
if (!$valid_number) $contact_form_field_number = "<em>$contact_form_field_number</em>";
// verplichte velden die ingevuld moeten worden
if ($valid_location &&
$valid_name &&
$valid_adres &&
//$valid_postcode &&
$valid_city &&
//$valid_url &&
//$valid_tel &&
$valid_email &&
$valid_emailname &&
//$valid_message &&
$valid_subject &&
$valid_number)
{
$error_reporting = error_reporting(E_ERROR | E_PARSE);
// volgorde zoals het in de e-mail komt te staan
$tekst .= "Locatie: $_POST[Location]\r\n";
$tekst .= "Naam locatie: $_POST[Name]\r\n";
$tekst .= "Adres: $_POST[Adres]\r\n";
$tekst .= "Postcode: $_POST[Postcode]\r\n";
$tekst .= "Plaats: $_POST[City]\r\n";
$tekst .= "Website: $_POST[Url]\r\n";
$tekst .= "Telefoon: $_POST[Tel]\r\n";
$tekst .= "Lat: $_POST[Lat]\r\n";
$tekst .= "Lon: $_POST[Lon]\r\n";
$tekst .= "Naam: $_POST[Emailname]\r\n";
$tekst .= "E-mail: $_POST[Email]\r\n";
$tekst .= "Opmerking: $_POST[Message]\r\n";
$subject .= "$_POST[Subject]";
$mail_sent = mail($contact_form_your_email, $subject, $tekst,
"To: $contact_form_your_name <$contact_form_your_email>\r\n" .
"From: {$_POST['Name']} <{$_POST['Email']}>\r\n");
error_reporting($error_reporting);
if ($mail_sent)
echo "<div class=\"error\"><h4>$contact_form_sent</h4></div>";
else echo "<div class=\"error\"><em class=\"error\">$contact_form_not_sent</em></div>";
if ($mail_sent) $_POST = array();
}
else echo "<div class=\"contact_form\"><div class=\"error\"><em>$contact_form_invalid_data</em></div></div>";
}
$_SESSION['Number'] = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT);
?>
<html>
<head>
<script type="text/javascript" language="Javascript" src="http://maps.google.nl/maps?file=api&v=2&key=ABQIAAAAFfkqaO0Jn3KjadwVU2kClRTvQnD7WYhfEkTfU7dDbXSM7xa89xSn6tM7QIDCWQ-96jKBE3toIjzW-w" type="text/javascript"></script>
<script type="text/javascript" language="Javascript">
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + "geen geldig adres gevonden.");
} else {
var map = new GMap2(document.getElementById("map_canvas"));
marker = new GMarker(point, {draggable: true});
map.setCenter(marker.getPoint(), 17);
map.setMapType( G_SATELLITE_MAP );
document.getElementById('lat').value = marker.getPoint().lat().toFixed(6);
document.getElementById('lon').value = marker.getPoint().lng().toFixed(6);
GEvent.addListener(marker, "click", function() {
var point = marker.getPoint();
var lat = document.getElementById('lat').value;
var lon = document.getElementById('lon').value;
var naam = document.getElementById('naam').value;
var adres = document.getElementById('adres').value;
var postcode = document.getElementById('postcode').value;
var plaats = document.getElementById('plaats').value;
var url = document.getElementById('url').value;
var telefoon = document.getElementById('telefoon').value;
var land = document.getElementById('land').value;
var html = ("<b>" + naam + "</b><br>" + adres + "<br>" + postcode + "<br>" + plaats + "<br>" + land + "<br><br>" + url + "<br>" + telefoon + "<br>Lat: " + lat + "<br>Lon: " + lon);
marker.openInfoWindowHtml(html);
});
GEvent.addListener(marker, "dragstart", function() {
map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var point = marker.getPoint();
document.getElementById('lat').value = marker.getPoint().lat().toFixed(6);
document.getElementById('lon').value = marker.getPoint().lng().toFixed(6);
});
map.addOverlay(marker);
}
}
);
}
}
</script>
<style type="text/css">
<!--
table { font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
<link rel="stylesheet" href="style-simple.css">
<?php { ?>
<body onLoad="load()" onUnload="GUnload()">
<form name="form" method="post" action="<?=$_SERVER['REQUEST_URI'];?>">
<table width="900">
<tr>
<td colspan="2"><div align="left"><?=$contact_form_field_formname;?></div></td>
</tr>
<tr>
<td width="445"><table width="100%">
<tr>
<th colspan="3"></th>
</tr>
<tr>
<th><?=$contact_form_field_subject;?>*</th>
<td colspan="2">
<p>
<input name="Subject" type="radio" value="toevoeging nieuwe locatie"<?php if ($_POST['Subject'] == 'toevoeging nieuwe locatie') { echo 'checked'; } ?> />
Toevoeging<br />
<input name="Subject" type="radio" value="wijziging locatie"<?php if ($_POST['Subject'] == 'wijziging locatie') { echo 'checked'; } ?> />
Wijziging<br />
<input name="Subject" type="radio" value="verwijdering locatie"<?php if ($_POST['Subject'] == 'verwijdering locatie') { echo 'checked'; } ?> />
Verwijdering
</div></td>
</tr>
<tr>
<th colspan="3">------------------- Locatie informatie -------------------</th>
</tr>
<tr>
<th width="127"><?=$contact_form_field_location; ?>*</th>
<td colspan="2"><div class="input">
<p>
<input name="Location" type="radio" value="green"<?php if ($_POST['Location'] == 'green') { echo 'checked'; } ?> />
Autoclub<br />
<input name="Location" type="radio" value="red"<?php if ($_POST['Location'] == 'red') { echo 'checked'; } ?> />
Vliegclub<br />
<input name="Location" type="radio" value="blue"<?php if ($_POST['Location'] == 'blue') { echo 'checked'; } ?> />
Bootclub<br />
<input name="Location" type="radio" value="gray"<?php if ($_POST['Location'] == 'gray') { echo 'checked'; } ?> />
Winkel </p>
</div></td></tr>
<tr>
<th><?=$contact_form_field_name; ?>*</th><td colspan="2"><div class="input"><input name="Name" id="naam" type="text" value="<?=contact_form_post('Name');?>"></div></td></tr>
<tr>
<th><?=$contact_form_field_adres; ?>*</th><td colspan="2"><div class="input"><input name="Adres" id="adres" type="text" value="<?=contact_form_post('Adres');?>"></div></td></tr>
<tr><th><?=$contact_form_field_postcode; ?></th><td colspan="2"><div class="input"><input name="Postcode" id="postcode" type="text" value="<?=contact_form_post('Postcode');?>" size="10">
</div></td></tr>
<tr>
<th><?=$contact_form_field_city;?>*</th><td colspan="2"><div class="input"><input name="City" id="plaats" type="text" value="<?=contact_form_post('City');?>"></div></td></tr>
<tr><th><?=$contact_form_field_url;?></th><td colspan="2"><div class="input"><input name="Url" id="url" type="text" value="<?=contact_form_post('Url');?>" /></div></td></tr>
<tr><th><?=$contact_form_field_tel;?></th><td colspan="2"><div class="input"><input name="Tel" id="telefoon" type="text" value="<?=contact_form_post('Tel');?>" size="10" />
</div></td></tr>
<tr>
<th colspan="3">------------------- Google informatie -------------------</th>
</tr>
<tr>
<th><?=$contact_form_field_lat;?></th>
<td colspan="2"><div class="input"><input name="Lat" id="lat" type="text" value="<?=contact_form_post('Lat');?>" size="10" readonly="readonly" style="background: #CCCCCC; border: solid 1px; border-color:#999999" /><input name="locatie" type="hidden" value="" size="60" />
</div></td>
</tr>
<tr>
<th><?=$contact_form_field_lon;?></th>
<td colspan="2"><div class="input"><input name="Lon" id="lon" type="text" value="<?=contact_form_post('Lon');?>" size="10" readonly="readonly" style="background: #CCCCCC; border: solid 1px; border-color:#999999"
/><input name="land" type="hidden" id="land" value="Nederland" />
</div></td>
</tr>
<tr>
<th colspan="3">
------------------ Afzender informatie ------------------</th>
</tr>
<tr>
<th><?=$contact_form_field_emailname; ?>*</th>
<td colspan="2"><div class="input"><input name="Emailname" type="text" value="<?=contact_form_post('Emailname');?>"></div></td>
</tr>
<tr>
<th><?=$contact_form_field_email; ?>*</th>
<td colspan="2"><div class="input"><input name= "Email" type="text" value="<?=contact_form_post('Email');?>"></div></td>
</tr>
<tr><th><?=$contact_form_field_message;?></th><td colspan="2"><div class="input"><textarea name="Message" cols="25" rows="4"><?=contact_form_post('Message');?></textarea></div></td></tr>
<tr>
<th><?=$contact_form_field_number;?>*</th><td colspan="2"><div class="input" style="float: left;"><input type="text" name="Number" autocomplete="off">
</div>
</td>
</tr>
<tr>
<th> </th>
<td width="65"><img width="60" height="17" src="<?=$contact_form_image_url;?>?sname=<?=session_name();?>" alt=""></td>
<td width="220"><span class="input" style="float: left;"><small>
<?=$contact_form_field_prompt;?>
</small></span></td>
</tr>
<tr>
<th colspan="3"> </th>
</tr>
<tr><th><input type="button" value="Toon op kaart" onClick="showAddress(this.form.adres.value +', ' + this.form.plaats.value);" /></th><td colspan="2"><input id="submit_contact" class="submit" type="submit" name="Contact" value="<?=$contact_form_button;?>"></td></tr>
</table></td>
<td width="443" valign="top"><div id="map_canvas" style="width: 460px; height: 500px"></div>
<br>
* verplichte velden</td>
</tr>
</table>
</form>
<?php } ?>
</div>
------
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
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
<?php
// Copyright (C) 2008 Ilya S. Lyubinskiy. All rights reserved.
session_name($_GET['sname']); session_start();
$t_num = isset($_SESSION['Number']) ? $_SESSION['Number'] : '0000';
if (get_magic_quotes_gpc() && !function_exists('strip_slashes_deep'))
{
function strip_slashes_deep($value)
{
if (is_array($value)) return array_map('strip_slashes_deep', $value);
return stripslashes($value);
}
$_GET = strip_slashes_deep($_GET);
$_POST = strip_slashes_deep($_POST);
$_COOKIE = strip_slashes_deep($_COOKIE);
}
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: Fri, 31 Dec 1999 23:59:59 GMT");
header("Content-type: image/png");
$image = imagecreate(60, 17);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imagestring ($image, 3, 13, 2, $t_num, $black);
imagepng ($image);
imagedestroy($image);
?>
// Copyright (C) 2008 Ilya S. Lyubinskiy. All rights reserved.
session_name($_GET['sname']); session_start();
$t_num = isset($_SESSION['Number']) ? $_SESSION['Number'] : '0000';
if (get_magic_quotes_gpc() && !function_exists('strip_slashes_deep'))
{
function strip_slashes_deep($value)
{
if (is_array($value)) return array_map('strip_slashes_deep', $value);
return stripslashes($value);
}
$_GET = strip_slashes_deep($_GET);
$_POST = strip_slashes_deep($_POST);
$_COOKIE = strip_slashes_deep($_COOKIE);
}
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: Fri, 31 Dec 1999 23:59:59 GMT");
header("Content-type: image/png");
$image = imagecreate(60, 17);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imagestring ($image, 3, 13, 2, $t_num, $black);
imagepng ($image);
imagedestroy($image);
?>
Gewijzigd op 01/01/1970 01:00:00 door Milcoi
Plaats even alles tussen tags.
http://www.modelbouwlocaties.nl/contact-test.php
nu lukt het me niet om de verstuurd bevestiging rechtsonderin te krijgen. (onder * verplichte velden)
het liefst toon ik deze melding op een apparte pagina waarna je terug kan gaan naar de main page.
niemand die me hiermee kan helpen?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Deze aanpak zou ik volgen, maar er zijn vast nog meer manieren.
EDIT: toch maar even in php getypt voor de duidelijkheid en header moet altijd voor alles worden uitgevoerd wat geen PHP is natuurlijk
Gewijzigd op 01/01/1970 01:00:00 door Rotu
Dit kan ik 1 op 1 overnemen in mijn code?
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
error_reporting($error_reporting);
if ($mail_sent)
echo "<div class=\"error\"><h4>$contact_form_sent</h4></div>";
else echo "<div class=\"error\"><em class=\"error\">$contact_form_not_sent</em></div>";
if ($mail_sent) $_POST = array();
}
else echo "<div class=\"contact_form\"><div class=\"error\"><em>$contact_form_invalid_data</em></div></div>";
Alleen dit stukje zou ik graag op een andere pagina willen tonen:
nu helemaal:
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
error_reporting($error_reporting);
if ($mail_sent)
header('Location: succespagina.php');
else echo "<div class=\"error\"><em class=\"error\">$contact_form_not_sent</em></div>";
if ($mail_sent) $_POST = array();
}
else echo "<div class=\"contact_form\"><div class=\"error\"><em>$contact_form_invalid_data</em></div></div>";
if ($mail_sent)
header('Location: succespagina.php');
else echo "<div class=\"error\"><em class=\"error\">$contact_form_not_sent</em></div>";
if ($mail_sent) $_POST = array();
}
else echo "<div class=\"contact_form\"><div class=\"error\"><em>$contact_form_invalid_data</em></div></div>";
Gelieve Niet Bumpen::
Gewijzigd op 01/01/1970 01:00:00 door Milcoi
Daarnaast zou ik bij je if- en else-statements consequent met { en } werken. Hoewel dat voor een enkele regel code na zo'n statement niet per se nodig is, vergroot het wel de duidelijkheid van je code. En dat komt jou alleen maar ten goede. Dus:
de melding is nu in hetzelfde venster en niet op een ander. Het probleem wat ik heb is dat de melding bovenaan staat en dat wil ik variable. Het liefst onder de * is verplicht melding.
alles werkt nu, ik ben door jullie commentaar op het juiste spoor gezet. Bedankt hiervoor.
Zijn er nog overige aanpassingen die bijv uit beveiligings oogpunt beter kunnen? ect.....