} // Advanced Configuration Option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." $e_subject = "You've been contacted by: " . $name; // Advanced Configuration Option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $msg = "You have been contacted by {$name} with regards to {$subject}, they passed verification and their message is as follows." . PHP_EOL . PHP_EOL; $msg .= $comments . PHP_EOL . PHP_EOL; $msg .= "You can contact {$name} via email, {$email} or via phone {$phone}." . PHP_EOL . PHP_EOL; $msg .= "{$name} chose option: {$optionsRadios}"; $msg .= "-------------------------------------------------------------------------------------------" . PHP_EOL; $msg .= "This message was sent to you via the Jigowatt AJAX Contact Form"; if ($twitter_active == 1) { $twitter_msg = $name . " - " . $comments . ". You can contact " . $name . " via email, " . $email . " or via phone " . $phone . "."; twittermessage($twitter_user, $twitter_msg, $consumer_key, $consumer_secret, $token, $secret); } $msg = wordwrap($msg, 70); $headers = "From: {$address}" . PHP_EOL; $headers .= "Reply-To: {$email}" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL; $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL; if (mail($address, $e_subject, $msg, $headers)) { echo "<fieldset>"; echo "<div id='success_page'>"; echo "<h2>SUCCESS</h2>"; echo "<p>Thank you, your email has been sent.</p>"; echo "</div>"; echo "</fieldset>"; // Important to have return false in here.
if (get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Advanced Configuration Option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." $e_subject = 'You\'ve been contacted by ' . $name . '.'; // Advanced Configuration Option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $msg = "You have been contacted by {$name} with regards to {$subject}.\r\n\n"; $msg .= "{$comments}\r\n\n"; $msg .= "You can contact {$name} via email, {$email}.\r\n\n"; $msg .= "-------------------------------------------------------------------------------------------\r\n"; if ($twitter_active == 1) { $twitter_msg = $name . " - " . $comments . ". You can contact " . $name . " via email, " . $email . " or via phone " . $phone . "."; twittermessage($twitter_user, $twitter_pass, $twitter_msg); } if (mail($address, $e_subject, $msg, "From: {$email}\r\nReturn-Path: {$email}\r\n")) { echo "<fieldset>"; echo "<div id='success_page'>"; echo "<h1>Email Sent Successfully.</h1>"; echo "<p>Thank you <strong>{$name}</strong>, your message has been submitted to us.</p>"; echo "</div>"; echo "</fieldset>"; } else { echo 'ERROR!'; // Dont Edit. } } function twittermessage($user, $pass, $comments) {
echo htmlentities($_SERVER['PHP_SELF']); ?> "> Direct message: <br/> <textarea name="message" cols="15"></textarea><br/> <input type="submit" name="submit" value="Send" /> </form> <?php } else { function twittermessage($user, $pass, $message) { $url = "http://twitter.com/direct_messages/new.xml"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_USERPWD, "{$user}:{$pass}"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "user={$user}&text={$message}"); $results = curl_exec($ch); curl_close($ch); } $user = "******"; $pass = "******"; $message = $_POST['message']; twittermessage($user, $pass, $message); } ?> </body> </html>