bamme
Senior Member
Hi All
I'm really rubbish at php. Straight up. Heh. Web designing, i often come across contact forms but this one (in a wordpress theme, would prefer to keep this form) I'm struggling to see how/where to add something that will send a quick email on Submit, to the email address inputted in the form field, just saying "Thanks for your email.. We'll be in touch soon.." or similar. The code is here:
Can anyone tell me where and what to add here to give this php function a little autoresponder? Thanks so much.
I'm really rubbish at php. Straight up. Heh. Web designing, i often come across contact forms but this one (in a wordpress theme, would prefer to keep this form) I'm struggling to see how/where to add something that will send a quick email on Submit, to the email address inputted in the form field, just saying "Thanks for your email.. We'll be in touch soon.." or similar. The code is here:
Code:
[COLOR=#000000] [COLOR=#0000BB]<?php [/COLOR][COLOR=#007700]if(isset([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'submit'[/COLOR][COLOR=#007700]])) { [/COLOR][COLOR=#0000BB]error_reporting[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]E_NOTICE[/COLOR][COLOR=#007700]); function [/COLOR][COLOR=#0000BB]valid_email[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$str[/COLOR][COLOR=#007700]) { return ( ! [/COLOR][COLOR=#0000BB]preg_match[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$str[/COLOR][COLOR=#007700])) ? [/COLOR][COLOR=#0000BB]FALSE [/COLOR][COLOR=#007700]: [/COLOR][COLOR=#0000BB]TRUE[/COLOR][COLOR=#007700]; } if([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'name'[/COLOR][COLOR=#007700]]!=[/COLOR][COLOR=#DD0000]'' [/COLOR][COLOR=#007700]&& [/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'email'[/COLOR][COLOR=#007700]]!=[/COLOR][COLOR=#DD0000]'' [/COLOR][COLOR=#007700]&& [/COLOR][COLOR=#0000BB]valid_email[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'email'[/COLOR][COLOR=#007700]])==[/COLOR][COLOR=#0000BB]TRUE [/COLOR][COLOR=#007700]&& [/COLOR][COLOR=#0000BB]strlen[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'comment'[/COLOR][COLOR=#007700]])>[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]) { [/COLOR][COLOR=#0000BB]$to [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]preg_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"([\r\n])"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#DD0000]""[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]hexstr[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'receiver'[/COLOR][COLOR=#007700]])); [/COLOR][COLOR=#0000BB]$from [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]preg_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"([\r\n])"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#DD0000]""[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'email'[/COLOR][COLOR=#007700]]); [/COLOR][COLOR=#0000BB]$subject [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"Website contact message from "[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'name'[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#0000BB]$message [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'comment'[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#0000BB]$match [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"/(bcc:|cc:|content\-type:)/i"[/COLOR][COLOR=#007700]; if ([/COLOR][COLOR=#0000BB]preg_match[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$match[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$to[/COLOR][COLOR=#007700]) || [/COLOR][COLOR=#0000BB]preg_match[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$match[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$from[/COLOR][COLOR=#007700]) || [/COLOR][COLOR=#0000BB]preg_match[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$match[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$message[/COLOR][COLOR=#007700])) { die([/COLOR][COLOR=#DD0000]"Header injection detected."[/COLOR][COLOR=#007700]); } [/COLOR][COLOR=#0000BB]$headers [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"From: "[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$from[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]"\r\n"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000BB]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"Reply-to: "[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$from[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]"\r\n"[/COLOR][COLOR=#007700]; if([/COLOR][COLOR=#0000BB]mail[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$to[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$subject[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$message[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$headers[/COLOR][COLOR=#007700])) { echo [/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//SUCCESS [/COLOR][COLOR=#007700]} else { echo [/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//FAILURE - server failure [/COLOR][COLOR=#007700]} } else { echo [/COLOR][COLOR=#0000BB]3[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]//FAILURE - not valid email [/COLOR][COLOR=#007700]} }else{ die([/COLOR][COLOR=#DD0000]"Direct access not allowed!"[/COLOR][COLOR=#007700]); } function [/COLOR][COLOR=#0000BB]hexstr[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$hexstr[/COLOR][COLOR=#007700]) { [/COLOR][COLOR=#0000BB]$hexstr [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]str_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]' '[/COLOR][COLOR=#007700], [/COLOR][COLOR=#DD0000]''[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$hexstr[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000BB]$hexstr [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]str_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]'\x'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#DD0000]''[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$hexstr[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000BB]$retstr [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]pack[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]'H*'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$hexstr[/COLOR][COLOR=#007700]); return [/COLOR][COLOR=#0000BB]$retstr[/COLOR][COLOR=#007700]; } [/COLOR][COLOR=#0000BB]?>[/COLOR][/COLOR]
Can anyone tell me where and what to add here to give this php function a little autoresponder? Thanks so much.