Contact formulier replay klant
Ik heb een contactformulier aangemaakt. Zodra formulier is ingevuld dient er een bevestiging naar webeigenaar en klant opgestuurd te worden.
Webeigenaar krijgt het wel maar klant niet...
En andere issue is dat de locatie niet wordt doorgelinkt nadat formulier is ingevuld naar de website die bovenaan staat...
Na 6uur debuggen heb ik opgegeven, ik hoop dat jullie me kunnen helpen!
Code:
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
<?php
// Form data names and variables
$FName = 'aanmeldformulier';
$FEmail = '[email protected]';
$FSpamEmail = '';
$FWebsiteAfter = 'http://www.doorlink.htm';
$FCopyToSender = 1;
$FExporting = 0;
$FDMode = 3;
$FMesFromT = 2;
$FMesName = 3;
$FMesFrom = 12;
$FMesSubjectT = 2;
$FMesSubject = 12;
$FCopyToSender = 1;
$FExporting = 0;
$FieldsNo = 16;
$FieldName[0] = 'Naam moeder:';
$FieldType[0] = 1;
$FieldTypeExt[0] = '';
$FieldCols[0] = 30;
$FieldRows[0] = 0;
$FieldS[0] = 0;
$FieldRequired[0] = 1;
$FieldName[1] = 'Naam vader:';
$FieldType[1] = 1;
$FieldTypeExt[1] = '';
$FieldCols[1] = 30;
$FieldRows[1] = 0;
$FieldS[1] = 0;
$FieldRequired[1] = 0;
$FieldName[2] = 'Voornaam kind:';
$FieldType[2] = 1;
$FieldTypeExt[2] = '';
$FieldCols[2] = 30;
$FieldRows[2] = 0;
$FieldS[2] = 0;
$FieldRequired[2] = 1;
$FieldName[3] = 'Achternaam kind:';
$FieldType[3] = 1;
$FieldTypeExt[3] = '';
$FieldCols[3] = 30;
$FieldRows[3] = 0;
$FieldS[3] = 0;
$FieldRequired[3] = 1;
$FieldName[4] = 'Geslacht:';
$FieldType[4] = 4;
$FieldTypeExt[4] = 'Jongen|Meisje';
$FieldCols[4] = 0;
$FieldRows[4] = 0;
$FieldS[4] = 0;
$FieldRequired[4] = 1;
$FieldName[5] = '(verwachte) geboortedatum:';
$FieldType[5] = 1;
$FieldTypeExt[5] = '';
$FieldCols[5] = 30;
$FieldRows[5] = 0;
$FieldS[5] = 0;
$FieldRequired[5] = 1;
$FieldName[6] = 'Is er al een kind geplaatst in KDV ?:';
$FieldType[6] = 4;
$FieldTypeExt[6] = 'Ja|Nee';
$FieldCols[6] = 0;
$FieldRows[6] = 0;
$FieldS[6] = 0;
$FieldRequired[6] = 0;
$FieldName[7] = 'Adres:';
$FieldType[7] = 1;
$FieldTypeExt[7] = '';
$FieldCols[7] = 30;
$FieldRows[7] = 0;
$FieldS[7] = 0;
$FieldRequired[7] = 1;
$FieldName[8] = 'Postcode:';
$FieldType[8] = 1;
$FieldTypeExt[8] = '';
$FieldCols[8] = 30;
$FieldRows[8] = 0;
$FieldS[8] = 0;
$FieldRequired[8] = 1;
$FieldName[9] = 'Woonplaats:';
$FieldType[9] = 1;
$FieldTypeExt[9] = '';
$FieldCols[9] = 30;
$FieldRows[9] = 0;
$FieldS[9] = 0;
$FieldRequired[9] = 1;
$FieldName[10] = 'Telefoonnummer thuis:';
$FieldType[10] = 1;
$FieldTypeExt[10] = '';
$FieldCols[10] = 30;
$FieldRows[10] = 0;
$FieldS[10] = 0;
$FieldRequired[10] = 0;
$FieldName[11] = 'Mobiel:';
$FieldType[11] = 1;
$FieldTypeExt[11] = '';
$FieldCols[11] = 30;
$FieldRows[11] = 0;
$FieldS[11] = 0;
$FieldRequired[11] = 1;
$FieldName[12] = 'Email:';
$FieldType[12] = 1;
$FieldTypeExt[12] = '';
$FieldCols[12] = 30;
$FieldRows[12] = 0;
$FieldS[12] = 0;
$FieldRequired[12] = 1;
$FieldName[13] = 'Gewenste opvang:';
$FieldType[13] = 5;
$FieldTypeExt[13] = 'BuitenSchoolse Opvang|Dagopvang';
$FieldCols[13] = 0;
$FieldRows[13] = 0;
$FieldS[13] = 0;
$FieldRequired[13] = 1;
$FieldName[14] = 'Gewenste ingangsdatum:';
$FieldType[14] = 1;
$FieldTypeExt[14] = '';
$FieldCols[14] = 30;
$FieldRows[14] = 0;
$FieldS[14] = 0;
$FieldRequired[14] = 1;
$FieldName[15] = 'Hiermee ga ik akkoord met de voorwaarden zoals deze zijn vastgelegd:';
$FieldType[15] = 4;
$FieldTypeExt[15] = 'Ja';
$FieldCols[15] = 0;
$FieldRows[15] = 0;
$FieldS[15] = 0;
$FieldRequired[15] = 1;
// Error Messages
$HtmlErrorStart = '<font size="2" color="#CC0808">';
$HtmlErrorEnd = '</font>';
$msgErrorTooLongs = ' is too long! (Max ';
$msgErrorTooLonge = ' characters)';
$msgErrorTooShorts = ' is too short! (Min ';
$msgErrorTooShorte = ' characters)';
$msgErrorFieldEmpty = ' is empty! ( This field is required )';
$msgError = 'Error : ';
$msgErrorBadFields = 'Some fields are empty or invalid.';
// Needed functions
// --------------------------------------------------------------
function checkminsize($input, $min) // Check a string size
{
if (strlen($input)<$min) return 0;
else return 1;
}
// --------------------------------------------------------------
function checkmaxsize($input, $max) // Check a string size
{
if (strlen($input)>$max) return 0;
else return 1;
}
// --------------------------------------------------------------
function CheckTextSize($text, $min, $max, $errno, $errfieldname)
{
global $mmsg, $verifyok, $HtmlErrorStart, $HtmlErrorEnd, $msgErrorTooLongs, $msgErrorTooLonge, $msgErrorTooShorts, $msgErrorTooShorte, $msgErrorFieldEmpty, $mmsgt, $msgError, $msgErrorBadFields;
if (!checkminsize($text,$min))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooShorts . $min . $msgErrorTooShorte . $HtmlErrorEnd;
$verifyok = 0;
}
if (!checkmaxsize($text,$max))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooLongs . $max . $msgErrorTooLonge . $HtmlErrorEnd;
$verifyok = 0;
}
if ($min>0)
if (!checkminsize($text,1))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorFieldEmpty . $HtmlErrorEnd;
$verifyok = 0;
}
if ($verifyok == 0 )
{
$mmsg[0] = $msgError . $msgErrorBadFields;
$mmsgt = 1;
}
return $verifyok;
}
// --------------------------------------------------------------
function SecurityCheckCode($Turing)
{
global $ImageCode;
if ( !isset( $_SESSION['turing_string'] ) ) { $ImageCode = ''; return 1; }
else if ( strtoupper($_SESSION['turing_string']) == strtoupper($Turing) ) { $ImageCode = 'ok'; return 1; }
else { $ImageCode = 'wrong'; return 0; }
}
// --------------------------------------------------------------
function getip() // Returns the real Ip in most cases
{
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$realip = $_SERVER["HTTP_CLIENT_IP"];
} else {
$realip = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$realip = getenv( 'HTTP_CLIENT_IP' );
} else {
$realip = getenv( 'REMOTE_ADDR' );
}
}
return $realip;
}
// Processing form
// --------------------------------------------------------------
session_start();
$RealIp = getip();
if ( $_SESSION['FReferer'] == '' )
{
$R = @$_SERVER['HTTP_REFERER'];
if ( R != '' ) $_SESSION['FReferer'] = $R;
}
$Referer = $_SESSION['FReferer'];
// -------------------------------------------------------------------------------------
function CheckEmail($email,$minsize,$maxsize,$err,$fieldname)
{
global $mmsg, $mmsgt, $HtmlErrorStart, $HtmlErrorEnd, $verifyok;
// check if the email string is not empty, has at least 4 chars, is smaller than 64
CheckTextSize($email, $minsize, $maxsize, $err, $fieldname);
if ( ($minsize == 0 ) AND ( $email == '') ) return 0;
// check if is has a valid email format [email protected]
if ( ! (valid_email($email)) )
{$mmsg[$err] = $HtmlErrorStart . 'Email does not appear to be valid' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0; return 1;}
// check if the email string contains more than 1 email
if ( substr_count($FEmail, '@') > 1 )
{$mmsg[$err] = $HtmlErrorStart . 'Only one email is allowed' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0;};
}
// -------------------------------------------------------------------------------------
function valid_email($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
// Get form settings and fields
for ($i=0;$i<$FieldsNo;$i++)
{
if ( $FieldType[$i] ==3 )
{
// checkbox
$FieldData[$i] = '';
$Options = explode('|', $FieldTypeExt[$i]);
$OptionsNo = count($Options);
for ($j=0;$j<$OptionsNo;$j++)
{
$fd = trim($_POST['FieldData' . $i . '-' . $j]);
$FieldData[$i] .= $fd;
if ( ($j<($OptionsNo-1)) and ( $fd !='' ) ) $FieldData[$i] .= ', ';
}
}
else $FieldData[$i] = trim($_POST['FieldData' . $i]);
}
if ( $HTTP_POST_VARS )
{
// Basic verifications of the form submitted, check if the version is ok
// and the fields number corsesponds
if ($FieldsNo <> count($FieldData))
{
echo 'Error: The number of submitted data fields ( ' . count($FieldData) . ' ) does not corespond to the form ( ' . $FName . ' wich has ' . $FieldsNo . ' fields ).';
return 3;
}
$Hida2 = trim($_POST['hida2']);
if ($Hida2 != '')
{
echo 'Error: Spam submission detected ).';
return 4;
}
$mmsgt = 0;
$verifyok = 1;
$SpamScore = 0;
$DupFields = 0;
$Spam = 0;
$Hida2 = trim($_POST['hida2']);
if ($Hida2 != '')
{
$mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 1;
}
$SpamWord = array( 'http', 'URL', 'cialis', 'viagra', 'xxx', 'valium');
for ($i=0;$i<$FieldsNo;$i++)
if ($FieldType[$i]<6)
{
if ($FieldRequired[$i] == 1)
{
CheckTextSize($FieldData[$i], 1, 10000, ($i+1), $FieldName[$i]);
if ( ($FMesFromT ==2) && ( $FMesFrom == $i ) ) CheckEmail($FieldData[$FMesFrom], 4, 64, ($i+1), $FieldName[$i]);
}
for ($j=0;$j<Count($SpamWord);$j++)
{
$SpamNo = substr_count($FieldData[$i],$SpamWord[$j]);
$SpamScore = $SpamScore + $SpamNo;
}
for ($j=$i+1;$j<$FieldsNo;$j++)
if ( ( ($FieldType[$i] ==1 ) or ( $FieldType[$i] ==2) ) and ( ($FieldType[$j] ==1 ) or ( $FieldType[$j] ==2) ) ) if ($FieldData[$i] != '' ) if ($FieldData[$i] == $FieldData[$j]) $DupFields = $DupFields + 1;
}
if ($SpamScore > 10)
{
$mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 2;
}
// Check if the Turing Code is correct
$Turing = trim($_POST['Turing']);
if ( ! ( SecurityCheckCode($Turing)) )
{
$mmsg[0] = $HtmlErrorStart . 'Error: The Code that you entered is not the correct code from the Verification Image!' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 4;
}
// check for new lines in inapropiate places
// check for new lines in the From name and email
if ($FMesFromT ==2)
if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesName] . $FieldData[$FMesFrom]))
$FMesFromT = 1;
// check for new lines in the Subject
if ($FMesSubjectT ==2)
if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesSubject]))
$FMesSubjectT = 1;
if ( ($mmsgt !=1) or ($Spam > 0 ) )
{
$mime_boundary=md5(time());
// Prepare email
$headers = "";
if ($Spam == 0)
{
if ($FMesFromT ==1)
$fromaddress = "EmailMeForm <[email protected]>";
elseif ($FMesFromT ==2)
{
$CustomerName = $FieldData[$FMesName];
$CustomerEmail = $FieldData[$FMesFrom];
$fromaddress = "$CustomerName <[email protected]>";
}
$headers .= "From: $fromaddress\r\n";
$headers .= "Reply-To: $FieldData[$FMesName] <$FieldData[$FMesFrom]>\r\n";
}
else $headers .= "From: EmailMeForm <[email protected]>\r\n";
$subject = 'Feedback via the ' . $FName;
if ($FMesSubjectT ==2)
$subject = $FName . ': ' . $FieldData[$FMesSubject];
if ($Spam > 0) $subject = $FName . ' Spam submission detected';
$headers .= "Message-ID: <".time()."[email protected]>\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary. '"' . "\r\n\r\n";
$body = "--".$mime_boundary. "\r\n";
$body .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
if ($Spam > 0)
{
$body .= " The following submission has been detected as spam.\r\n";
$body .= ' Spam type: ';
switch ($Spam) {
case 1 : $body .= "Bad hidden field\r\n\r\n"; break;
case 2 : $body .= "Bad words detected\r\n\r\n"; break;
case 3 : $body .= "Same data was filled in more than half fields\r\n\r\n"; break;
case 4 : $body .= "Bad or invalid captcha code\r\n\r\n"; break;
case 5 : $body .= "Unknown Ip\r\n\r\n"; break;
case 6 : $body .= "Injection attack\r\n\r\n"; break;
case 7 : $body .= "Injection attack\r\n\r\n"; break;
}
}
for ($i=0;$i<$FieldsNo;$i++)
if ($FieldType[$i]<6) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
$body .= "---------------------------------------------------------------------\r\n";
$body .= 'Visitor Ip: ' . $RealIp . "\r\n";
if ($FExporting == 1)
{
$body .= "*** Text Database Entry ***\r\n";
for ($i=0;$i<($FieldsNo-1);$i++)
$body .= '"' . $FieldName[$i] . '",';
$body .= '"' . $FieldName[$FieldsNo-1] . '"' . "\r\n";
for ($i=0;$i<($FieldsNo-1);$i++)
$body .= '"' . $FieldData[$i] . '",';
$body .= '"' . $FieldData[$FieldsNo-1] . '"' . "\r\n";
}
// Adding attachments
for($i=0; $i<$FieldsNo; $i++)
if ($FieldType[$i] == 6)
{
$fd = 'FieldData' . $i;
if (is_uploaded_file($_FILES["$fd"][tmp_name]))
{
$handle=fopen($_FILES["$fd"][tmp_name], 'rb');
$f_contents=fread($handle, filesize($_FILES["$fd"][tmp_name]));
$f_contents=chunk_split(base64_encode($f_contents));
$f_type=filetype($_FILES["$fd"][tmp_name]);
fclose($handle);
# Attachment
$filename = $_FILES["$fd"][name];
$body .= "--".$mime_boundary."\r\n";
$body .= 'Content-Type: ' . $_FILES["$fd"][type] . '; name="' . $filename . '"' . "\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-Description: $FieldName[$i]\r\n";
$body .= 'Content-Disposition: attachment; filename="' . $filename . '"'."\r\n\r\n"; $body .= $f_contents."\r\n\r\n";
}
}
# Finished
$body .= "--".$mime_boundary."--\r\n\r\n"; // finish with two eol's for better security. see Injection.
if ($Spam == 0)
{
// We try to send the email with verification code
if (mail("$FEmail", $subject, $body, $headers) )
if ( $SaveEmails == 1)
{
// The mail has been sent succesfuly, update the email table
$query="UPDATE email SET Status='delivered', DateDelivered = NOW() WHERE EmailId='$EmailId'";
mysql_query($query) or die(mysql_error());
}
}
else if ($FSpamEmail != '') @mail("$FSpamEmail", $subject, $body, $headers);
// If Sending a copy to visitor is checked and the field from where to get the visitor email
// address is selected we send a copy to the visitor
if ( ($FCopyToSender == 1) && ($FMesFromT ==2) AND ($Spam == 0) )
{
$headers = "From: $FFirstName $FLastName <[email protected]>\r\n";
$headers = "Reply-to: $FFirstName $FLastName <$FEmail>\r\n";
$subject = 'We have received your email';
if ($FMesSubjectT ==2)
$subject .= ': ' . $FieldData[$FMesSubject];
$body = 'Hello ' . $FieldData[$FMesName] . ",\r\n \r\n";
$body .= "We have received your form submission, thank you!\r\n \r\n";
$body .= "Below is the data submitted:\r\n \r\n";
for ($i=0;$i<$FieldsNo;$i++)
if ( $FieldType[$i] <6 ) $body .= $FieldName[$i] . ' : ' . $FieldData[$i] . "\r\n";
$body .= "\r\nBest regards,\r\n";
$body .= "$FFirstName $FLastName\r\n";
// We try to send the email with verification code
@mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
}
if ($Spam == 0 )
{
// Redirect visitor if form was on site, or display an message if form was in window
switch ($FDMode) {
case 0 :
case 1 :
case 2 : $loc = 'Location: ' . $FWebsiteAfter;
header($loc);
exit;
case 3: echo 'We received your message, thank you for contacting us.';
}
return 0;
}
}
}
// preparing font formating
$ft = '<font';
$sf = 0;
if ($FFontFace != '' ) { $ft .= ' face="' . $FFontFace . '"'; $sf = 1; }
if ($FFontSize != '' ) { $ft .= ' size="' . $FFontSize . '"'; $sf = 1; }
if ($FColor != '' ) { $ft .= ' color="' . $FColor . '"'; $sf = 1; }
if ($sf == 1 ) { $ft .= '>'; $fta = '</font>'; }
else {$ft = ''; $fta = ''; }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>aanmeldformulier</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<form method="post" action="" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td>
aanmeldformulier<div style="<? if ($mmsg[0] != '')
if ($mmsgt == 1) { echo ' display : block; font: 12px Verdana, Arial, sans-serif; font-weight: bold; color: #CC0808; width : 100%; padding: 6px; border : 1px #FFD39F dashed; background-color: #FFFFEB; margin-bottom: 16px; '; }
else echo 'display : none; '; ?>" id="mainmsg"> <? echo $mmsg[0]; ?></div>
</td>
</tr>
</table>
<br>
<table cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr valign="top">
<td nowrap> Naam moeder:
</td>
<td>
<input type="text" name="FieldData0" value="<? echo $FieldData[0] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[1];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Naam vader:
</td>
<td>
<input type="text" name="FieldData1" value="<? echo $FieldData[1] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[2];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Voornaam kind:
</td>
<td>
<input type="text" name="FieldData2" value="<? echo $FieldData[2] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[3];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Achternaam kind:
</td>
<td>
<input type="text" name="FieldData3" value="<? echo $FieldData[3] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[4];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Geslacht:
</td>
<td>
<input type=radio name="FieldData4" value="Jongen" id="radio40"><label for="radio40">Jongen</label><br><input type=radio name="FieldData4" value="Meisje" id="radio41"><label for="radio41">Meisje</label><br><?
echo ' ' . $mmsg[5];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> (verwachte) geboortedatum:
</td>
<td>
<input type="text" name="FieldData5" value="<? echo $FieldData[5] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[6];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Is er al een kind geplaatst in KDV?:
</td>
<td>
<input type=radio name="FieldData6" value="Ja" id="radio60"><label for="radio60">Ja</label><br><input type=radio name="FieldData6" value="Nee" id="radio61"><label for="radio61">Nee</label><br><?
echo ' ' . $mmsg[7];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Adres:
</td>
<td>
<input type="text" name="FieldData7" value="<? echo $FieldData[7] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[8];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Postcode:
</td>
<td>
<input type="text" name="FieldData8" value="<? echo $FieldData[8] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[9];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Woonplaats:
</td>
<td>
<input type="text" name="FieldData9" value="<? echo $FieldData[9] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[10];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Telefoonnummer thuis:
</td>
<td>
<input type="text" name="FieldData10" value="<? echo $FieldData[10] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[11];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Mobiel:
</td>
<td>
<input type="text" name="FieldData11" value="<? echo $FieldData[11] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[12];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Email:
</td>
<td>
<input type="text" name="FieldData12" value="<? echo $FieldData[12] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[13];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Gewenste opvang:
</td>
<td>
<select name="FieldData13"><option value="BuitenSchoolse Opvang">BuitenSchoolse Opvang</option><option value="Dagopvang">Dagopvang</option></select><?
echo ' ' . $mmsg[14];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Gewenste ingangsdatum:
</td>
<td>
<input type="text" name="FieldData14" value="<? echo $FieldData[14] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[15];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Hiermee ga ik akkoord met de voorwaarden zoals deze zijn vastgelegd:
</td>
<td>
<input type=radio name="FieldData15" value="Ja" id="radio150"><label for="radio150">Ja</label><br><?
echo ' ' . $mmsg[16];
?>
</td>
</tr>
<tr>
<td> </td>
<td align="middle">
<input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none;">
<input type="submit" class="btn" value="Stuur door" name="Submit">
<input type="reset" class="btn" value=" Opnieuw " name="Clear">
</td>
</tr>
</table>
</form>
</body>
</html>
// Form data names and variables
$FName = 'aanmeldformulier';
$FEmail = '[email protected]';
$FSpamEmail = '';
$FWebsiteAfter = 'http://www.doorlink.htm';
$FCopyToSender = 1;
$FExporting = 0;
$FDMode = 3;
$FMesFromT = 2;
$FMesName = 3;
$FMesFrom = 12;
$FMesSubjectT = 2;
$FMesSubject = 12;
$FCopyToSender = 1;
$FExporting = 0;
$FieldsNo = 16;
$FieldName[0] = 'Naam moeder:';
$FieldType[0] = 1;
$FieldTypeExt[0] = '';
$FieldCols[0] = 30;
$FieldRows[0] = 0;
$FieldS[0] = 0;
$FieldRequired[0] = 1;
$FieldName[1] = 'Naam vader:';
$FieldType[1] = 1;
$FieldTypeExt[1] = '';
$FieldCols[1] = 30;
$FieldRows[1] = 0;
$FieldS[1] = 0;
$FieldRequired[1] = 0;
$FieldName[2] = 'Voornaam kind:';
$FieldType[2] = 1;
$FieldTypeExt[2] = '';
$FieldCols[2] = 30;
$FieldRows[2] = 0;
$FieldS[2] = 0;
$FieldRequired[2] = 1;
$FieldName[3] = 'Achternaam kind:';
$FieldType[3] = 1;
$FieldTypeExt[3] = '';
$FieldCols[3] = 30;
$FieldRows[3] = 0;
$FieldS[3] = 0;
$FieldRequired[3] = 1;
$FieldName[4] = 'Geslacht:';
$FieldType[4] = 4;
$FieldTypeExt[4] = 'Jongen|Meisje';
$FieldCols[4] = 0;
$FieldRows[4] = 0;
$FieldS[4] = 0;
$FieldRequired[4] = 1;
$FieldName[5] = '(verwachte) geboortedatum:';
$FieldType[5] = 1;
$FieldTypeExt[5] = '';
$FieldCols[5] = 30;
$FieldRows[5] = 0;
$FieldS[5] = 0;
$FieldRequired[5] = 1;
$FieldName[6] = 'Is er al een kind geplaatst in KDV ?:';
$FieldType[6] = 4;
$FieldTypeExt[6] = 'Ja|Nee';
$FieldCols[6] = 0;
$FieldRows[6] = 0;
$FieldS[6] = 0;
$FieldRequired[6] = 0;
$FieldName[7] = 'Adres:';
$FieldType[7] = 1;
$FieldTypeExt[7] = '';
$FieldCols[7] = 30;
$FieldRows[7] = 0;
$FieldS[7] = 0;
$FieldRequired[7] = 1;
$FieldName[8] = 'Postcode:';
$FieldType[8] = 1;
$FieldTypeExt[8] = '';
$FieldCols[8] = 30;
$FieldRows[8] = 0;
$FieldS[8] = 0;
$FieldRequired[8] = 1;
$FieldName[9] = 'Woonplaats:';
$FieldType[9] = 1;
$FieldTypeExt[9] = '';
$FieldCols[9] = 30;
$FieldRows[9] = 0;
$FieldS[9] = 0;
$FieldRequired[9] = 1;
$FieldName[10] = 'Telefoonnummer thuis:';
$FieldType[10] = 1;
$FieldTypeExt[10] = '';
$FieldCols[10] = 30;
$FieldRows[10] = 0;
$FieldS[10] = 0;
$FieldRequired[10] = 0;
$FieldName[11] = 'Mobiel:';
$FieldType[11] = 1;
$FieldTypeExt[11] = '';
$FieldCols[11] = 30;
$FieldRows[11] = 0;
$FieldS[11] = 0;
$FieldRequired[11] = 1;
$FieldName[12] = 'Email:';
$FieldType[12] = 1;
$FieldTypeExt[12] = '';
$FieldCols[12] = 30;
$FieldRows[12] = 0;
$FieldS[12] = 0;
$FieldRequired[12] = 1;
$FieldName[13] = 'Gewenste opvang:';
$FieldType[13] = 5;
$FieldTypeExt[13] = 'BuitenSchoolse Opvang|Dagopvang';
$FieldCols[13] = 0;
$FieldRows[13] = 0;
$FieldS[13] = 0;
$FieldRequired[13] = 1;
$FieldName[14] = 'Gewenste ingangsdatum:';
$FieldType[14] = 1;
$FieldTypeExt[14] = '';
$FieldCols[14] = 30;
$FieldRows[14] = 0;
$FieldS[14] = 0;
$FieldRequired[14] = 1;
$FieldName[15] = 'Hiermee ga ik akkoord met de voorwaarden zoals deze zijn vastgelegd:';
$FieldType[15] = 4;
$FieldTypeExt[15] = 'Ja';
$FieldCols[15] = 0;
$FieldRows[15] = 0;
$FieldS[15] = 0;
$FieldRequired[15] = 1;
// Error Messages
$HtmlErrorStart = '<font size="2" color="#CC0808">';
$HtmlErrorEnd = '</font>';
$msgErrorTooLongs = ' is too long! (Max ';
$msgErrorTooLonge = ' characters)';
$msgErrorTooShorts = ' is too short! (Min ';
$msgErrorTooShorte = ' characters)';
$msgErrorFieldEmpty = ' is empty! ( This field is required )';
$msgError = 'Error : ';
$msgErrorBadFields = 'Some fields are empty or invalid.';
// Needed functions
// --------------------------------------------------------------
function checkminsize($input, $min) // Check a string size
{
if (strlen($input)<$min) return 0;
else return 1;
}
// --------------------------------------------------------------
function checkmaxsize($input, $max) // Check a string size
{
if (strlen($input)>$max) return 0;
else return 1;
}
// --------------------------------------------------------------
function CheckTextSize($text, $min, $max, $errno, $errfieldname)
{
global $mmsg, $verifyok, $HtmlErrorStart, $HtmlErrorEnd, $msgErrorTooLongs, $msgErrorTooLonge, $msgErrorTooShorts, $msgErrorTooShorte, $msgErrorFieldEmpty, $mmsgt, $msgError, $msgErrorBadFields;
if (!checkminsize($text,$min))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooShorts . $min . $msgErrorTooShorte . $HtmlErrorEnd;
$verifyok = 0;
}
if (!checkmaxsize($text,$max))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorTooLongs . $max . $msgErrorTooLonge . $HtmlErrorEnd;
$verifyok = 0;
}
if ($min>0)
if (!checkminsize($text,1))
{
$mmsg[$errno] = $HtmlErrorStart . $errfieldname . $msgErrorFieldEmpty . $HtmlErrorEnd;
$verifyok = 0;
}
if ($verifyok == 0 )
{
$mmsg[0] = $msgError . $msgErrorBadFields;
$mmsgt = 1;
}
return $verifyok;
}
// --------------------------------------------------------------
function SecurityCheckCode($Turing)
{
global $ImageCode;
if ( !isset( $_SESSION['turing_string'] ) ) { $ImageCode = ''; return 1; }
else if ( strtoupper($_SESSION['turing_string']) == strtoupper($Turing) ) { $ImageCode = 'ok'; return 1; }
else { $ImageCode = 'wrong'; return 0; }
}
// --------------------------------------------------------------
function getip() // Returns the real Ip in most cases
{
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$realip = $_SERVER["HTTP_CLIENT_IP"];
} else {
$realip = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$realip = getenv( 'HTTP_CLIENT_IP' );
} else {
$realip = getenv( 'REMOTE_ADDR' );
}
}
return $realip;
}
// Processing form
// --------------------------------------------------------------
session_start();
$RealIp = getip();
if ( $_SESSION['FReferer'] == '' )
{
$R = @$_SERVER['HTTP_REFERER'];
if ( R != '' ) $_SESSION['FReferer'] = $R;
}
$Referer = $_SESSION['FReferer'];
// -------------------------------------------------------------------------------------
function CheckEmail($email,$minsize,$maxsize,$err,$fieldname)
{
global $mmsg, $mmsgt, $HtmlErrorStart, $HtmlErrorEnd, $verifyok;
// check if the email string is not empty, has at least 4 chars, is smaller than 64
CheckTextSize($email, $minsize, $maxsize, $err, $fieldname);
if ( ($minsize == 0 ) AND ( $email == '') ) return 0;
// check if is has a valid email format [email protected]
if ( ! (valid_email($email)) )
{$mmsg[$err] = $HtmlErrorStart . 'Email does not appear to be valid' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0; return 1;}
// check if the email string contains more than 1 email
if ( substr_count($FEmail, '@') > 1 )
{$mmsg[$err] = $HtmlErrorStart . 'Only one email is allowed' . $HtmlErrorEnd; $mmsgt = 1; $verifyok = 0;};
}
// -------------------------------------------------------------------------------------
function valid_email($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
// Get form settings and fields
for ($i=0;$i<$FieldsNo;$i++)
{
if ( $FieldType[$i] ==3 )
{
// checkbox
$FieldData[$i] = '';
$Options = explode('|', $FieldTypeExt[$i]);
$OptionsNo = count($Options);
for ($j=0;$j<$OptionsNo;$j++)
{
$fd = trim($_POST['FieldData' . $i . '-' . $j]);
$FieldData[$i] .= $fd;
if ( ($j<($OptionsNo-1)) and ( $fd !='' ) ) $FieldData[$i] .= ', ';
}
}
else $FieldData[$i] = trim($_POST['FieldData' . $i]);
}
if ( $HTTP_POST_VARS )
{
// Basic verifications of the form submitted, check if the version is ok
// and the fields number corsesponds
if ($FieldsNo <> count($FieldData))
{
echo 'Error: The number of submitted data fields ( ' . count($FieldData) . ' ) does not corespond to the form ( ' . $FName . ' wich has ' . $FieldsNo . ' fields ).';
return 3;
}
$Hida2 = trim($_POST['hida2']);
if ($Hida2 != '')
{
echo 'Error: Spam submission detected ).';
return 4;
}
$mmsgt = 0;
$verifyok = 1;
$SpamScore = 0;
$DupFields = 0;
$Spam = 0;
$Hida2 = trim($_POST['hida2']);
if ($Hida2 != '')
{
$mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 1;
}
$SpamWord = array( 'http', 'URL', 'cialis', 'viagra', 'xxx', 'valium');
for ($i=0;$i<$FieldsNo;$i++)
if ($FieldType[$i]<6)
{
if ($FieldRequired[$i] == 1)
{
CheckTextSize($FieldData[$i], 1, 10000, ($i+1), $FieldName[$i]);
if ( ($FMesFromT ==2) && ( $FMesFrom == $i ) ) CheckEmail($FieldData[$FMesFrom], 4, 64, ($i+1), $FieldName[$i]);
}
for ($j=0;$j<Count($SpamWord);$j++)
{
$SpamNo = substr_count($FieldData[$i],$SpamWord[$j]);
$SpamScore = $SpamScore + $SpamNo;
}
for ($j=$i+1;$j<$FieldsNo;$j++)
if ( ( ($FieldType[$i] ==1 ) or ( $FieldType[$i] ==2) ) and ( ($FieldType[$j] ==1 ) or ( $FieldType[$j] ==2) ) ) if ($FieldData[$i] != '' ) if ($FieldData[$i] == $FieldData[$j]) $DupFields = $DupFields + 1;
}
if ($SpamScore > 10)
{
$mmsg[0] = $HtmlErrorStart . 'Error: Your submission is spam.' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 2;
}
// Check if the Turing Code is correct
$Turing = trim($_POST['Turing']);
if ( ! ( SecurityCheckCode($Turing)) )
{
$mmsg[0] = $HtmlErrorStart . 'Error: The Code that you entered is not the correct code from the Verification Image!' . $HtmlErrorEnd;
$mmsgt = 1;
$Spam = 4;
}
// check for new lines in inapropiate places
// check for new lines in the From name and email
if ($FMesFromT ==2)
if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesName] . $FieldData[$FMesFrom]))
$FMesFromT = 1;
// check for new lines in the Subject
if ($FMesSubjectT ==2)
if (preg_match("/(%0A|%0D|\\n+|\\r+)/i",$FieldData[$FMesSubject]))
$FMesSubjectT = 1;
if ( ($mmsgt !=1) or ($Spam > 0 ) )
{
$mime_boundary=md5(time());
// Prepare email
$headers = "";
if ($Spam == 0)
{
if ($FMesFromT ==1)
$fromaddress = "EmailMeForm <[email protected]>";
elseif ($FMesFromT ==2)
{
$CustomerName = $FieldData[$FMesName];
$CustomerEmail = $FieldData[$FMesFrom];
$fromaddress = "$CustomerName <[email protected]>";
}
$headers .= "From: $fromaddress\r\n";
$headers .= "Reply-To: $FieldData[$FMesName] <$FieldData[$FMesFrom]>\r\n";
}
else $headers .= "From: EmailMeForm <[email protected]>\r\n";
$subject = 'Feedback via the ' . $FName;
if ($FMesSubjectT ==2)
$subject = $FName . ': ' . $FieldData[$FMesSubject];
if ($Spam > 0) $subject = $FName . ' Spam submission detected';
$headers .= "Message-ID: <".time()."[email protected]>\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary. '"' . "\r\n\r\n";
$body = "--".$mime_boundary. "\r\n";
$body .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
if ($Spam > 0)
{
$body .= " The following submission has been detected as spam.\r\n";
$body .= ' Spam type: ';
switch ($Spam) {
case 1 : $body .= "Bad hidden field\r\n\r\n"; break;
case 2 : $body .= "Bad words detected\r\n\r\n"; break;
case 3 : $body .= "Same data was filled in more than half fields\r\n\r\n"; break;
case 4 : $body .= "Bad or invalid captcha code\r\n\r\n"; break;
case 5 : $body .= "Unknown Ip\r\n\r\n"; break;
case 6 : $body .= "Injection attack\r\n\r\n"; break;
case 7 : $body .= "Injection attack\r\n\r\n"; break;
}
}
for ($i=0;$i<$FieldsNo;$i++)
if ($FieldType[$i]<6) $body .= $FieldName[$i] . ': ' . $FieldData[$i] . "\r\n";
$body .= "---------------------------------------------------------------------\r\n";
$body .= 'Visitor Ip: ' . $RealIp . "\r\n";
if ($FExporting == 1)
{
$body .= "*** Text Database Entry ***\r\n";
for ($i=0;$i<($FieldsNo-1);$i++)
$body .= '"' . $FieldName[$i] . '",';
$body .= '"' . $FieldName[$FieldsNo-1] . '"' . "\r\n";
for ($i=0;$i<($FieldsNo-1);$i++)
$body .= '"' . $FieldData[$i] . '",';
$body .= '"' . $FieldData[$FieldsNo-1] . '"' . "\r\n";
}
// Adding attachments
for($i=0; $i<$FieldsNo; $i++)
if ($FieldType[$i] == 6)
{
$fd = 'FieldData' . $i;
if (is_uploaded_file($_FILES["$fd"][tmp_name]))
{
$handle=fopen($_FILES["$fd"][tmp_name], 'rb');
$f_contents=fread($handle, filesize($_FILES["$fd"][tmp_name]));
$f_contents=chunk_split(base64_encode($f_contents));
$f_type=filetype($_FILES["$fd"][tmp_name]);
fclose($handle);
# Attachment
$filename = $_FILES["$fd"][name];
$body .= "--".$mime_boundary."\r\n";
$body .= 'Content-Type: ' . $_FILES["$fd"][type] . '; name="' . $filename . '"' . "\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-Description: $FieldName[$i]\r\n";
$body .= 'Content-Disposition: attachment; filename="' . $filename . '"'."\r\n\r\n"; $body .= $f_contents."\r\n\r\n";
}
}
# Finished
$body .= "--".$mime_boundary."--\r\n\r\n"; // finish with two eol's for better security. see Injection.
if ($Spam == 0)
{
// We try to send the email with verification code
if (mail("$FEmail", $subject, $body, $headers) )
if ( $SaveEmails == 1)
{
// The mail has been sent succesfuly, update the email table
$query="UPDATE email SET Status='delivered', DateDelivered = NOW() WHERE EmailId='$EmailId'";
mysql_query($query) or die(mysql_error());
}
}
else if ($FSpamEmail != '') @mail("$FSpamEmail", $subject, $body, $headers);
// If Sending a copy to visitor is checked and the field from where to get the visitor email
// address is selected we send a copy to the visitor
if ( ($FCopyToSender == 1) && ($FMesFromT ==2) AND ($Spam == 0) )
{
$headers = "From: $FFirstName $FLastName <[email protected]>\r\n";
$headers = "Reply-to: $FFirstName $FLastName <$FEmail>\r\n";
$subject = 'We have received your email';
if ($FMesSubjectT ==2)
$subject .= ': ' . $FieldData[$FMesSubject];
$body = 'Hello ' . $FieldData[$FMesName] . ",\r\n \r\n";
$body .= "We have received your form submission, thank you!\r\n \r\n";
$body .= "Below is the data submitted:\r\n \r\n";
for ($i=0;$i<$FieldsNo;$i++)
if ( $FieldType[$i] <6 ) $body .= $FieldName[$i] . ' : ' . $FieldData[$i] . "\r\n";
$body .= "\r\nBest regards,\r\n";
$body .= "$FFirstName $FLastName\r\n";
// We try to send the email with verification code
@mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
}
if ($Spam == 0 )
{
// Redirect visitor if form was on site, or display an message if form was in window
switch ($FDMode) {
case 0 :
case 1 :
case 2 : $loc = 'Location: ' . $FWebsiteAfter;
header($loc);
exit;
case 3: echo 'We received your message, thank you for contacting us.';
}
return 0;
}
}
}
// preparing font formating
$ft = '<font';
$sf = 0;
if ($FFontFace != '' ) { $ft .= ' face="' . $FFontFace . '"'; $sf = 1; }
if ($FFontSize != '' ) { $ft .= ' size="' . $FFontSize . '"'; $sf = 1; }
if ($FColor != '' ) { $ft .= ' color="' . $FColor . '"'; $sf = 1; }
if ($sf == 1 ) { $ft .= '>'; $fta = '</font>'; }
else {$ft = ''; $fta = ''; }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>aanmeldformulier</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<form method="post" action="" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td>
aanmeldformulier<div style="<? if ($mmsg[0] != '')
if ($mmsgt == 1) { echo ' display : block; font: 12px Verdana, Arial, sans-serif; font-weight: bold; color: #CC0808; width : 100%; padding: 6px; border : 1px #FFD39F dashed; background-color: #FFFFEB; margin-bottom: 16px; '; }
else echo 'display : none; '; ?>" id="mainmsg"> <? echo $mmsg[0]; ?></div>
</td>
</tr>
</table>
<br>
<table cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr valign="top">
<td nowrap> Naam moeder:
</td>
<td>
<input type="text" name="FieldData0" value="<? echo $FieldData[0] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[1];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Naam vader:
</td>
<td>
<input type="text" name="FieldData1" value="<? echo $FieldData[1] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[2];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Voornaam kind:
</td>
<td>
<input type="text" name="FieldData2" value="<? echo $FieldData[2] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[3];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Achternaam kind:
</td>
<td>
<input type="text" name="FieldData3" value="<? echo $FieldData[3] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[4];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Geslacht:
</td>
<td>
<input type=radio name="FieldData4" value="Jongen" id="radio40"><label for="radio40">Jongen</label><br><input type=radio name="FieldData4" value="Meisje" id="radio41"><label for="radio41">Meisje</label><br><?
echo ' ' . $mmsg[5];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> (verwachte) geboortedatum:
</td>
<td>
<input type="text" name="FieldData5" value="<? echo $FieldData[5] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[6];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Is er al een kind geplaatst in KDV?:
</td>
<td>
<input type=radio name="FieldData6" value="Ja" id="radio60"><label for="radio60">Ja</label><br><input type=radio name="FieldData6" value="Nee" id="radio61"><label for="radio61">Nee</label><br><?
echo ' ' . $mmsg[7];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Adres:
</td>
<td>
<input type="text" name="FieldData7" value="<? echo $FieldData[7] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[8];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Postcode:
</td>
<td>
<input type="text" name="FieldData8" value="<? echo $FieldData[8] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[9];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Woonplaats:
</td>
<td>
<input type="text" name="FieldData9" value="<? echo $FieldData[9] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[10];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Telefoonnummer thuis:
</td>
<td>
<input type="text" name="FieldData10" value="<? echo $FieldData[10] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[11];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Mobiel:
</td>
<td>
<input type="text" name="FieldData11" value="<? echo $FieldData[11] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[12];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Email:
</td>
<td>
<input type="text" name="FieldData12" value="<? echo $FieldData[12] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[13];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Gewenste opvang:
</td>
<td>
<select name="FieldData13"><option value="BuitenSchoolse Opvang">BuitenSchoolse Opvang</option><option value="Dagopvang">Dagopvang</option></select><?
echo ' ' . $mmsg[14];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Gewenste ingangsdatum:
</td>
<td>
<input type="text" name="FieldData14" value="<? echo $FieldData[14] ?>" maxlength="100" size="30"><?
echo ' ' . $mmsg[15];
?>
</td>
</tr>
<tr valign="top">
<td nowrap> Hiermee ga ik akkoord met de voorwaarden zoals deze zijn vastgelegd:
</td>
<td>
<input type=radio name="FieldData15" value="Ja" id="radio150"><label for="radio150">Ja</label><br><?
echo ' ' . $mmsg[16];
?>
</td>
</tr>
<tr>
<td> </td>
<td align="middle">
<input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none;">
<input type="submit" class="btn" value="Stuur door" name="Submit">
<input type="reset" class="btn" value=" Opnieuw " name="Clear">
</td>
</tr>
</table>
</form>
</body>
</html>
mod_edit:
Waarom in 's hemelsnaam zo'n lap code plaatsen, relevante code posten helpt ervoor te zorgen dat je eerder geholpen wordt.
Gewijzigd op 01/01/1970 01:00:00 door Web
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
// dit had je
$FWebsiteAfter = 'http://www.doorlink.htm;
// dit moet het zijn
$FWebsiteAfter = 'http://www.doorlink.htm';
?>
// dit had je
$FWebsiteAfter = 'http://www.doorlink.htm;
// dit moet het zijn
$FWebsiteAfter = 'http://www.doorlink.htm';
?>
tevens wat voor editor gebruik je aangezien je dit in de meeste kan zien aan de kleur.
Gewijzigd op 01/01/1970 01:00:00 door mitchel
Ik heb mijn doorlinkpagina gewijzigd voordat ik hier had geplaatst, dus per ongeluk ' weggehaald, maar dat is nu wel aangepast en in origineel script is het ook gewoon goed.
Kan je niet iets meer je code inkorten ofzo? Je zult vast een klein idee hebben waar het probleem zit?
Ik denk dat je probleem op regel 527 zit, dus echt het mail gedeelte voor naar degene die het formulier heeft ingevuld. Variabelen buiten quotes halen is ook een vak:
Code (php)
1
2
3
2
3
<?php
mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
?>
mail("$FieldData[$FMesName] <$FieldData[$FMesFrom]>", $subject, $body, $headers);
?>
Fouten:
1) Waarom een @, als het niet goed gaat krijg je niets meer te zien, je hebt dus geen idee wat er gebeurt.
2) Waarom zet je die hele regel met variabelen (voor de ontvanger) tussen quotes? Nooit gehoord van variabelen buiten quotes?
Fout nummer 2 kom ik door je hele script tegen, gebruik dit niet maar werk met fatsoenlijke foutafhandeling.
Hoe moet het wel:
Code (php)
1
2
3
2
3
<?php
@mail($FieldData[$FMesName] .' <'.$FieldData[$FMesFrom].'>', $subject, $body, $headers);
?>
@mail($FieldData[$FMesName] .' <'.$FieldData[$FMesFrom].'>', $subject, $body, $headers);
?>
Gewijzigd op 01/01/1970 01:00:00 door Robert Deiman
Ik zal zometeen die quotes weghalen, alleen ik begrijp niet dat de code op een hostingserver wel doet en op andere niet...
HTTP_POST_VARS?
Ik neem aan ergens gevonden?
niet zelf gescript maar gegenereerd via een website. Na genereren kun je het testen en het werk bij hun prima maar bij mij niet. Alhoewel ik krijg wel bericht maar klant niet.
Niet zo'n ramp, maar ben echt benieuwd waaraan het ligt!
Dit is onoverzichtelijk, stel nou dat je over een paar maanden dit moet aanpassen, zelfs jij weet dan niet eens meer wat wat is.
Zo doe ik het altijd, maar jij moet natuurlijk iets bij je passen wat bij je style van je syntax werkt.
Code (php)
Daarbij, array's in strings is mogelijk maar.... doe dat liever niet.
Split de string gewoon open wanneer je er een waarde tussen wil plakken.
Code (php)
En naar mijn idee, valt deze form volledig te loopen en de maken met php.
In vele gevallen is dit veel flexibeler dat plain text forms met af en toe php input.
Gewijzigd op 01/01/1970 01:00:00 door Johan K