-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaily.php
32328 lines (11576 loc) · 474 KB
/
maily.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
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
$FM_VERS = "8.36"; // script version
/* ex:set ts=4 sw=4 et:
* FormMail PHP script from Tectite.com. This script requires PHP 4 or later.
* Copyright (c) 2001-2012 Root Software and Open Concepts (Vic) Pty Ltd
* (ABN 12 130 429 248), Melbourne, Australia.
* This script is free for all use as described in the "Copying and Use" and
* "Warranty and Disclaimer" sections below.
*
* Visit us at http://www.tectite.com/ for updates and more information.
*
* ** If you use Tectite FormMail, please support its development and other
* ** freeware products by putting the following link on your website:
* ** Visit www.tectite.com for free <a href="http://www.tectite.com/">FormMail</a>.
*
* Author: Russell Robinson, 2nd October 2001
*
* Read This First
* ~~~~~~~~~~~~~~~
* This script is very well documented and quite large! It looks daunting,
* but really isn't.
* If you have experience with PHP or other scripting languages,
* here's what you *need* to read:
* - Configuration (TARGET_EMAIL & DEF_ALERT)
* - Creating Forms
* That's it! (Alternatively, just read the Quick Start and/or
* Quicker Start section below).
* Full configuration documentation is here:
* http://www.tectite.com/fmdoc/index.php
*
* NOTE: do not read or modify this script or any PHP script
* with DreamWeaver or FrontPage!
* Many versions of those programs silently corrupt PHP scripts.
*
* Purpose:
* ~~~~~~~~
* To accept information from an HTML form via HTTP and mail it to recipients.
*
* What does this PHP script do?
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* On your web site, you may have one or more HTML forms that accept
* information from people visiting your website. Your aim is for your
* website to email that information to you and/or add it to a database.
* FormMail performs those functions.
*
* Quick Start
* ~~~~~~~~~~~
* 1. Edit this file and set TARGET_EMAIL for your requirements (near
* line 256 in this file - replace "yourhost\.com" with your mail server's
* name). We also strongly recommend you set DEF_ALERT (the next
* configuration below TARGET_EMAIL).
* 2. Install this file as formmail.php (or other name ending in .php)
* on your web server.
* Test alerts by using your browser to open a URL to the script:
* http://www.yourhost.com/formmail.php?testalert=1
* Alerts are the only way FormMail can tell you the details of
* errors or faults.
* 3. Create an HTML form and:
* - specify a hidden field called "recipients" with the email address
* of the person to receive the form's results.
* - in the your form tag set the action attribute to
* the formmail.php you uploaded to your web server
*
* Once you have FormMail working, you may be interested in some advanced
* usage and features. We have HOW-TO guides at www.tectite.com which
* describe many of the advanced processing you can do with FormMail.
* http://www.tectite.com/fmhowto/guides.php
*
* Quicker Start
* ~~~~~~~~~~~~~
* Use the FormMail Configuration Wizard here:
* http://www.tectite.com/wizards/fmconf.php
* By answering a few questions you'll get a configured FormMail and
* a sample HTML form ready to upload and use on your server.
*
* Features
* ~~~~~~~~
* For a list of features go to: http://www.tectite.com/formmailpage.php
*
* Security
* ~~~~~~~~
* Security is the primary concern in accepting data from your website
* visitors.
* Tectite FormMail has several security features designed into it. Note,
* however, it requires configuration for your particular web site.
*
* Configuration
* ~~~~~~~~~~~~~
* To configure this script, go to the section titled "CONFIGURATION"
* (after reading the legal stuff below).
*
* There is only one mandatory setting: TARGET_EMAIL
* and one strongly recommended setting: DEF_ALERT
*
* Full configuration information is available here:
* http://www.tectite.com/fmdoc/index.php
*
* Creating Forms
* ~~~~~~~~~~~~~~
* Go to this URL to learn how to write HTML forms for use with
* Tectite FormMail: http://www.tectite.com/fmdoc/creating_forms.php
*
* Copying and Use (Software License)
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Tectite FormMail is provided free of charge and may be freely distributed
* and used provided that you:
* 1. keep this header, including copyright and comments,
* in place and unmodified; and,
* 2. do not charge a fee for distributing it, without an agreement
* in writing with Root Software allowing you to do so; and,
* 3. if you modify FormMail before distributing it, you clearly
* identify:
* a) who you are
* b) how to contact you
* c) what changes you have made
* d) why you have made those changes.
*
* By using any of our products, including this script, you are
* agreeing to our standard Terms and Conditions, available here:
* http://www.tectite.com/TermsAndConditions.pdf
*
* This is free software and the Software License shown above
* is to be read in conjunction with our standard Terms and Conditions.
*
* Warranty and Disclaimer
* ~~~~~~~~~~~~~~~~~~~~~~~
* Tectite FormMail is provided free-of-charge and with ABSOLUTELY NO WARRANTY.
* It has not been verified for use in critical applications, including,
* but not limited to, medicine, defense, aircraft, space exploration,
* or any other potentially dangerous activity.
*
* By using Tectite FormMail you agree to indemnify Root Software and
* Open Concepts (Vic) Pty Ltd, their agents, employees, directors and
* associated companies and businesses from any liability whatsoever.
*
* We still care
* ~~~~~~~~~~~~~
* If you find a bug or fault in FormMail, please report it to us.
* We will respond to your report and make endeavours to rectify any
* faults you've detected as soon as possible.
*
* To contact us please register on our forums at:
* http://www.tectite.com/vbforums/
* or view our contact information:
* http://www.tectite.com/contacts.php
*
* Version History
* ~~~~~~~~~~~~~~~
* Near the top of this file, you'll find its version. The version
* line looks like this:
* $FM_VERS = "N.MM"; /* script version ...
*
* The version history used to be located within this file. However,
* starting with Version 8.00 we've moved it...
*
* You can read the complete version history of FormMail on our
* main website here:
* http://www.tectite.com/fmdoc/version_history.php
*/
FMDebug('Submission to: ' . (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '') . ' from: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''));
if (isset($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) === 'OPTIONS') {
FMDebug('CORS OPTIONS request');
CORS_Response();
exit;
}
//
// Capture the current date and time, for various purposes.
//
$lNow = time();
ini_set('track_errors', 1); // enable $php_errormsg
$aAlertInfo = array();
$aPHPVERSION = array();
$sLangID = ""; // the language ID
$aMessages = array(); // all FormMail messages in the appropriate
// language
$bUseOldVars = IsOldVersion($aPHPVERSION);
if (!IsPHPAtLeast("5.3.0"))
//
// disable this silly setting (usually not enabled)
// it's also deprecated from PHP version 5.3.0
//
set_magic_quotes_runtime(0);
//
// seed the random number generate if not version 4.2.0 or later
//
if (!IsPHPAtLeast("4.2.0"))
mt_srand(time());
//
// we set references to the appropriate arrays to handle PHP version differences
// Session vars are selected after we start the session.
//
if ($bUseOldVars) {
$aServerVars = &$HTTP_SERVER_VARS;
$aGetVars = &$HTTP_GET_VARS;
$aFormVars = &$HTTP_POST_VARS;
$aFileVars = &$HTTP_POST_FILES;
$aEnvVars = &$HTTP_ENV_VARS;
} else {
$aServerVars = &$_SERVER;
$aGetVars = &$_GET;
$aFormVars = &$_POST;
$aFileVars = &$_FILES;
$aEnvVars = &$_ENV;
}
$bIsGetMethod = false;
$bHasGetData = false;
if (!isset($REAL_DOCUMENT_ROOT))
SetRealDocumentRoot();
if (isset($aServerVars['SERVER_PORT']))
$SCHEME = ($aServerVars['SERVER_PORT'] == 80) ? "http://" : "https://";
else
$SCHEME = "";
if (isset($aServerVars['SERVER_NAME']) && $aServerVars['SERVER_NAME'] !== "")
$SERVER = $aServerVars['SERVER_NAME'];
elseif (isset($aServerVars['SERVER_ADDR']) && $aServerVars['SERVER_ADDR'] !== "")
$SERVER = $aServerVars['SERVER_ADDR'];
else
$SERVER = "";
/*
* Load an optional include file before the configuration.
* You can use this to set variables that can be used in the
* configuration section.
*/
@include("formmail-preconfig.inc.php");
/* * ************************************************************************** */
/* CONFIGURATION (do not alter this line in any way!!!) */
/* * ***************************************************************************
* This is the *only* place where you need to modify things to use formmail.php
* on your particular system. This section finishes at "END OF CONFIGURATION".
* Help for all settings can be found on our website:
* http://www.tectite.com/fmdoc/index.php
*
* Also, above each setting is a direct URL to the help information for the
* setting.
* *************************************************************************** */
/* Help: http://www.tectite.com/fmdoc/email_name.php */
define("EMAIL_NAME", "^[-a-z0-9.]+"); // the '^' is an important security feature!
/* Help: http://www.tectite.com/fmdoc/target_email.php */
$TARGET_EMAIL = array("^kyledurand@gmail\.com$", "^info@gicmd\.com$", "^service@gicmd\.ca$", "^ask@gicmd\.ca$",);
/* Help: http://www.tectite.com/fmdoc/def_alert.php */
define("DEF_ALERT", "kyledurand@gmail.com");
/* Help: http://www.tectite.com/fmdoc/site_domain.php */
$SITE_DOMAIN = "http://gicmd.com"; // your website domain name
/* Help: http://www.tectite.com/fmdoc/set_real_document_root.php */
$SET_REAL_DOCUMENT_ROOT = ""; // overrides the value set by SetRealDocumentRoot function
//
// override $REAL_DOCUMENT_ROOT from the $SET_REAL_DOCUMENT_ROOT value (if any)
// Do not alter the following code (next 3 lines)!
//
if (isset($SET_REAL_DOCUMENT_ROOT) && $SET_REAL_DOCUMENT_ROOT !== "")
$REAL_DOCUMENT_ROOT = $SET_REAL_DOCUMENT_ROOT;
/* Help: http://www.tectite.com/fmdoc/config_check.php */