X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=contact.php;fp=contact.php;h=769b2c54189028fd874e068a9fe58cba48ad55da;hb=608730c54e00a21b2d2615387e7980dd413eec39;hp=0000000000000000000000000000000000000000;hpb=3a7b73338492c387b55cbbe7c451a6e41624119c;p=wfpl-cms.git diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..769b2c5 --- /dev/null +++ b/contact.php @@ -0,0 +1,88 @@ +"; + $reply_to = $to; + if(isset($data['email']) and valid_email($data['email'])) { + $reply_to = $data['email']; + if($data['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $data['name']) !== false) { + $reply_to = "$data[name] <$reply_to>"; + } + } + $subject = "Your message via $host/contact"; + $email_template = new tem(); + $email_template->load('contact.email.txt'); + $email_template->sets($data); + $email_template->set('$host', this_host()); + $message = $email_template->run(); + $cc = ''; + $bcc = ''; + if(email($from, $to, $subject, $message, $reply_to, $cc, $bcc)) { + message('Due to an internal error, your message could not be sent. Please try again later.'); + $error = true; + } else { + message('Message sent'); + } + } + if($error !== true) { + # FIXME create this page or change this to go elsewhere + return './contact_thanks'; + } + } + # otherwise, we display the form again. We've got the form field + # values in $data and will put those back in the filds below. You + # should add some message asking people to fix their entry in + # whatever way you require. + } else { + # form not submitted, you can set default values like so: + #$data = array('name' => 'Yes'); + $data = array(); + } + + tem_set('form', $data); +}