* * Change History: * 9/13/2007 - Designed feedback form based on requirements from Gordon and * based mostly on the same form on the Expanding Maine's Work- * force website. */ //////////////////// // BEGIN SETTINGS // //////////////////// // Where are data saved to? This should be a file on the web server. $save_to = './tell_us-files/tell_us.log'; // Where (to whom) are submissions sent to? Enter as many email addresses as // you like. Separate multiple addresses with commas. $send_to = 'webmaster.brs@maine.gov'; // Build a notification message for Muskie. First a text-formatted message, // then an HTML version of the same. Both will be sent in a multipart email. $notification_text = <<

A new submission was received from the feedback form on the New Employmentforme.org website. Here is all the information submitted:

Reason for Visiting Website:
REPLACEME_REASON_FOR_VISITING_WEBSITE

How to Make Website Better:
REPLACEME_HOW_TO_MAKE_WEBSITE_BETTER

Other Comments:
REPLACEME_OTHER_COMMENTS

Description/Background:
REPLACEME_DESCRIPTION

Other Description/Background:
REPLACEME_OTHER_DESCRIPTION

Would Like a Response:
REPLACEME_RECEIVE_RESPONSE

E-mail Address:
REPLACEME_EMAIL

HTML; ////////////////// // END SETTINGS // ////////////////// // Was the Submit button clicked? if ($_REQUEST['Submit']) { // Initialize error message. $error_message = ''; // Was ANYTHING entered? if (trim($_REQUEST['Reason_For_Visiting_Website']) == "" && trim($_REQUEST['How_To_Make_Website_Better']) == "" && trim($_REQUEST['Other_Comments']) == "" && ! isset($_REQUEST['Description']) && trim($_REQUEST['Other_Description']) == "" && trim($_REQUEST['Email']) == "") $error_message = '

Nothing was entered!

'; // Email entered and matches? if ($_REQUEST['Email'] != $_REQUEST['Confirm_Email']) $error_message = '

Please enter your email address and confirm it is correct by re-entering it again!

'; // Email valid? if ($_REQUEST['Email'] != "" && ! preg_match("/^[A-Za-z0-9_\+-]+(\.[A-Za-z0-9_\+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.([A-Za-z]{2,4})$/", $_REQUEST['Email'])) $error_message = '

Please enter a valid email address!

'; // If no error message, proceed. if ($error_message == "") { // Stitch the self descriptions together. if (isset($_REQUEST['Description']) && count($_REQUEST['Description']) > 0) { $description_text = join("\n", $_REQUEST['Description']); $description_html = join('
', $_REQUEST['Description']); } // Indicate whether the submitter's indicated whether they would like to // receive a response. if (isset($_REQUEST['Receive_Response'])) $_REQUEST['Receive_Response'] ? $receive_response = 'Yes' : 'No'; else $receive_response = 'Not indicated'; // Build text formatted message. $notification_text = preg_replace("/REPLACEME_REASON_FOR_VISITING_WEBSITE/", stripslashes($_REQUEST['Reason_For_Visiting_Website']), $notification_text); $notification_text = preg_replace("/REPLACEME_HOW_TO_MAKE_WEBSITE_BETTER/", stripslashes($_REQUEST['How_To_Make_Website_Better']), $notification_text); $notification_text = preg_replace("/REPLACEME_OTHER_COMMENTS/", stripslashes($_REQUEST['Other_Comments']), $notification_text); $notification_text = preg_replace("/REPLACEME_DESCRIPTION/", $description_text, $notification_text); $notification_text = preg_replace("/REPLACEME_OTHER_DESCRIPTION/", stripslashes($_REQUEST['Other_Description']), $notification_text); $notification_text = preg_replace("/REPLACEME_RECEIVE_RESPONSE/", $receive_response, $notification_text); $notification_text = preg_replace("/REPLACEME_EMAIL/", $_REQUEST['Email'], $notification_text); // Build HTML formatted message. $notification_html = preg_replace("/REPLACEME_REASON_FOR_VISITING_WEBSITE/", stripslashes($_REQUEST['Reason_For_Visiting_Website']), $notification_html); $notification_html = preg_replace("/REPLACEME_HOW_TO_MAKE_WEBSITE_BETTER/", stripslashes($_REQUEST['How_To_Make_Website_Better']), $notification_html); $notification_html = preg_replace("/REPLACEME_OTHER_COMMENTS/", stripslashes($_REQUEST['Other_Comments']), $notification_html); $notification_html = preg_replace("/REPLACEME_DESCRIPTION/", $description_html, $notification_html); $notification_html = preg_replace("/REPLACEME_OTHER_DESCRIPTION/", stripslashes($_REQUEST['Other_Description']), $notification_html); $notification_html = preg_replace("/REPLACEME_RECEIVE_RESPONSE/", $receive_response, $notification_html); $notification_html = preg_replace("/REPLACEME_EMAIL/", $_REQUEST['Email'], $notification_html); // Log submission. $res = log_submission(); // Get random string to be used as boundary between different message // parts. $mime_boundary = get_random_alphanumeric_string(); // Email submission. $headers = 'From: Feedback Form '."\r\n"; $headers .= 'Reply-To: Feedback Form '."\r\n"; $headers .= 'MIME-Version: 1.0'."\r\n"; $headers .= 'Content-Type: multipart/alternative; boundary="'. $mime_boundary .'"'."\r\n"; $message = '--'. $mime_boundary ."\n"; $message .= 'Content-Type: text/plain; charset=UTF-8'."\n"; $message .= 'Content-Transfer-Encoding: 8bit'."\n\n"; $message .= $notification_text ."\n"; $message .= '--'. $mime_boundary ."\n"; $message .= 'Content-Type: text/html; charset=UTF-8'."\n"; $message .= 'Content-Transfer-Encoding: 8bit'."\n\n"; $message .= $notification_html ."\n"; $message .= '--'. $mime_boundary .'--'."\n\n"; // Send it. mail($send_to, "Feedback Received from Employmentforme.org", $message, $headers); header("Location: tell_us-thankyou.php"); exit; } } // A simple function to get a random alpha numeric string to use as a divider // in the multipart email message. function get_random_alphanumeric_string($len = 0) { // If a length for the string is not specified, then use the default: 32 // alpha numeric characters. $len == 0 ? $len = 32 : $len = $len; // A pool of characters to use in building the random string. $alphnum = "abcdefghijklmnopqrstuvwxyz0123456789"; // Initialize divider. $divider = ""; // Loop up to the string length specified. Build string one character at a // time. for ($i = 0; $i < $len; $i++) $divider .= $alphnum{rand(0,strlen($alphnum))}; // Done. return $divider; } // A simple function to log submissions. function log_submission() { // Get variables outside this function's scope. The $save_to variables is the // path to the log file used as a backup should email "fail." The // $notification_text variable is the text formatted email message used in // the log -- because we don't need to save an HTML formatted log file! global $save_to, $notification_text; // Open a file handled. $f = fopen($save_to, 'a+'); // Write (append) to the log file. fwrite($f, "\r\n".'--- BEGIN ---'."\r\n"); fwrite($f, "\r\n". date('\O\n l, F j, Y \a\t g:i A T') ."\r\n"); fwrite($f, $notification_text); fwrite($f, "\r\n".'---- END ----'."\r\n"); // Close. fclose($f); return true; } // A simple function to check already selected descriptions. function check_description($description = "") { // No argument? Then nothing's checked. if ($description == "") return ''; // No descriptions selected? Then nothing's checked. if (! isset($_REQUEST['Description']) || isset($_REQUEST['Description']) && count($_REQUEST['Description']) == 0) return ''; // Loop over whatever's selected. Match against the argument. for ($i = 0; $i < count($_REQUEST['Description']); $i++) if ($_REQUEST['Description'][$i] == $description) return 'checked="checked"'; // Default. return ''; } // Initialize the tabindex so users can navigate the form's fields with the tab // key on the keyboard. $tabindex = 1; ?> Tell Us What You Think - Employmentforme.org

Tell Us What You Think.




Please describe yourself from these options:
/>
/>
/>
/>
/>



/>    />