File tree 5 files changed +40
-36
lines changed
5 files changed +40
-36
lines changed Original file line number Diff line number Diff line change
1
+ # ignore html files that are used for form testing.
2
+ * .htm
3
+ * .html
4
+
5
+ # ignore shell scripts (I have one setup to rsync changed
6
+ # files to my hosting account for testing.)
7
+
8
+ * .sh
Original file line number Diff line number Diff line change 6
6
//------------EVERYTHING BELOW THIS POINT IS OPTIONAL---------------
7
7
8
8
//This is the name of the file to use when no template is passed.
9
+ //Useful if you're pointing multiple contacts to the same form.
10
+
9
11
$ templateFile = 'template.txt ' ; //Default is template.txt
10
12
11
13
//This is the default page that should show after the information is submitted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
require_once ('config.php ' );
4
4
5
+ function templateLogic ($ matches )
6
+ {
7
+ $ temp = trim ($ matches [0 ], "{} " );
8
+
9
+ if (isset ($ _POST [$ temp ]))
10
+ {
11
+ return $ _POST [$ temp ];
12
+ }
13
+ elseif ($ temp == "phpfEVERYTHING " )
14
+ {
15
+ foreach ($ _POST as $ key => $ value )
16
+ {
17
+ if ($ key == "recaptcha_challenge_field "
18
+ || $ key == "recaptcha_response_field " )
19
+ {
20
+ continue ;
21
+ }
22
+ $ everything .= $ key .": " .$ value ."<br> \n" ;
23
+ }
24
+
25
+ return $ everything ;
26
+ }
27
+
28
+ return "{TEMPLATE FIELD NOT SPECIFIED} " ;
29
+ }
30
+
5
31
6
32
if ($ recaptchaEnabled )
7
33
{
48
74
foreach ($ template as $ line )
49
75
{
50
76
$ emailBody .= preg_replace_callback (
51
- $ pattern , create_function (
52
- '$matches ' ,
53
- '$temp = trim($matches[0], "{}"); ' .
54
- 'if(isset($_POST[$temp])){ ' .
55
- 'return $_POST[$temp];} ' .
56
- 'echo $_POST[$temp]; return "{NOT SPECIFIED}"; ' ),
77
+ $ pattern , "templateLogic " ,
57
78
$ line );
58
79
}
59
80
Original file line number Diff line number Diff line change 1
- The {adjective1} {adjective2} {animal1} {verb} over the {adjective3} {animal2}.
1
+ New form submition from {email}
2
+
3
+ {phpfEVERYTHING}
2
4
You can’t perform that action at this time.
0 commit comments