/** * Error processing function * @param string $reason * @param int $type * @return void */ function print_error($reason, $type = 0) { $redirectOnFail = $_POST['redirectOnFail']; $replyEmailOnFail = $_POST['replyEmailOnFail']; if ($redirectOnFail == '') { build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet); // for missing required data if ($type == "missing") { if ($missing_field_redirect) { header("Location: {$missing_field_redirect}?error={$reason}"); exit; } else { $failMessage = 'The form was not submitted for the following reasons:<p>'; $failMessage .= '<ul>' . $reason . "\n" . '</ul>'; echo $failMessage; echo 'Please use your browser's back button to return to the form and try again.'; } } else { // every other error $failMessage = 'The form was not submitted because of the following reasons:<p>'; echo $failMessage; } echo "<br /><br />\n"; echo "<small>This form is powered by <a href=\"http://phpmailer.sourceforge.net/\">PHPMailer-FE.php " . VERSION . "</a></small>\n\n"; } else { $reason = str_replace('<li>', '', $reason); $reason = str_replace('</li>', '<br />', $reason); $failMessage = ''; if ($type == "missing") { if ($missing_field_redirect) { $failMessage .= $reason; } else { $failMessage .= 'The form was not submitted for the following reasons:<br /><br />'; $failMessage .= $reason; } } else { // every other error $failMessage .= ' The form was not submitted because of the following reasons:<br /><br />'; $failMessage .= $reason; } $failMessage .= "<br />"; $_POST['failMessage'] = $failMessage; $msgDisplay = getTplFile($redirectOnFail); echo $msgDisplay; } // code to send reply to sender on failure of form submission /* note your email HTML form has to include the variables * $recipient (this will be used as the TO: address) * $fromemail (this will be used as the FROM: address - should be your email address) * $fromname (this will be used as the FROM: name - should be your name) * all other aspects of the reply email have to be set by you ... you can use * variables from your form in the format $field. * in your form, use the code format * <php echo $recipient; ?> */ if ($replyEmailOnFail != '') { $msgSend = getTplFile($replyEmailOnFail); $replyEmail = array(); $replyEmail["text"] = stripslashes(html_entity_decode(strip_tags($msgSend))); $replyEmail["html"] = stripslashes($msgSend); $ccOrg = $cc; $cc = NULL; $bccOrg = $bcc; $bcc = NULL; if (trim($subjectEmailOnFail) != '') { $subject = $subjectEmailOnFail; } mail_it($replyEmail, $subject, $recipient, '', $email, false); $cc = $ccOrg; $bcc = $bccOrg; } // END code to send reply to sender on failure of form submission echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>'; exit; // exit so that no other processing is done after a failure or error }
$errorsList = array("Fixperms.sh failed, returned error code : " . $returned['return_val']); } break; case "FIX_FILE": #@exec("$FIXPERM -f ".$params["file"]." 2>&1", $trash, $code); $returned = execute_cmd($FIXPERM, array('-f', $params["file"])); if ($returned['return_val'] != 0) { $errorsList = array("Fixperms.sh failed, returned error code : " . $returned['return_val']); } break; default: $errorsList[] = array("Fail: Sorry, i do not know this type of action: " . $r['type']); break; } // We finished the action, notify the DB. d("Finishing... return value is : {$return}\n"); if (!$action->finish($r["id"], addslashes($return))) { $errorsList[] = "Cannot finish the action! Error while inserting the error value in the DB for action n°" . $r["id"] . " : action '" . $r["type"] . "'\nReturn value: " . addslashes($return) . "\n"; break; // Else we go into an infinite loop... AAAAHHHHHH } } // If an error occured, notify it to the admin if (count($errorsList)) { mail_it(); } // Unlock the script // @todo This could be handled by m_admin unlink(ALTERNC_DO_ACTION_LOCK); // Exit this script exit(0);
$string = trim($env_reports[$i]); if ($env_reports[$i] == "REMOTE_HOST") $content .= "REMOTE HOST: ".$REMOTE_HOST."\n"; else if ($env_reports[$i] == "REMOTE_USER") $content .= "REMOTE USER: "******"\n"; else if ($env_reports[$i] == "REMOTE_ADDR") $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n"; else if ($env_reports[$i] == "HTTP_USER_AGENT") $content .= "BROWSER: ". $HTTP_USER_AGENT."\n"; } } // if the subject option is not set: set the default if (!$subject) $subject = "Form submission"; // send it off mail_it(stripslashes($content), stripslashes($subject), $email, $recipient, $allowed_email_recipients_array); // if the redirect option is set: redirect them if ($redirect) { header ("Location: $redirect"); exit; } else { print "Thank you for your submission\n"; echo "<br><br>\n"; echo "<small>This form is powered by <a href=\"http://www.lumbroso.com/scripts/\">Jack's Formmail.php $version!</a></small>\n\n"; exit; } // <---------- THE END ----------> //
<?php /* 10/7/08 initial version of server-side mail 10/15/08 revised to pass addresses as pipe-delim'd string 3/7/09 added text_sel parameter 3/11/09 corrected call to mail_it() 7/28/10 Added inclusion of startup.inc.php for checking of network status and setting of file name variables to support no-maps versions of scripts. */ @session_start(); require_once 'incs/functions.inc.php'; //7/28/10 - functions_mail.php // snap(__LINE__); // ($to_str, $text, $ticket_id) - 10/15/08 dump($_POST); $caption = mail_it($_POST['frm_to'], $_POST['frm_text'], $_POST['frm_ticket_id'], $_POST['text_sel']); // ($to_str, $text, $ticket_id) - 10/15/08 ?>
function handle_mail($to_str, $ticket_id) { // 6/16/09 global $istest; $text = ""; $the_msg = mail_it($to_str, $text, $ticket_id, 3, TRUE); // get default msg text $temp = explode("\n", $text); $msg_lines = count($temp); ?> <SCRIPT> function handleResult(req) { // the called-back function <?php if ($istest) { print "\n\t alert(648);\n"; } ?> } // end function handle Result() function send_it(addr, msg) { // 12/13/09 function isValidEmail(str) { return (str.lastIndexOf(".") > 2) && (str.indexOf("@") > 0) && (str.lastIndexOf(".") > (str.indexOf("@")+1)) && (str.indexOf("@") == str.lastIndexOf("@")); } sep=outstr=errstr=""; temp = addr.split(','); // comma sep's for (i=0;i<temp.length;i++) { // build string of valid addresses if ((temp[i].trim().length>0) && (!(isValidEmail(temp[i].trim())))) {errstr +="\t" + temp[i].trim()+"\n";} else { if (temp[i].trim().length>0) { // OK and not empty? outstr +=sep + temp[i].trim(); sep = "|"; // note pipe separator } } } // end for () if (errstr.length>0) { // errors? alert("Invalid addresses:\n" +errstr ); return false; } if (outstr.length==0) { // empty? alert("Valid addresses required\n"); return false; } var url = "do_send.php"; // ($to_str, $subject_str, $text_str ) var the_to = addr; var the_subj = escape("New Dispatch"); var the_msg = escape(msg); // the variables var postData = "to_str=" + the_to +"&subject_str=" + the_subj + "&text_str=" + the_msg; // the post string sendRequest(url,dummy,postData) ; return true; } // end function send it() function dummy() { window.close(); } function ender() { $('sending').style.display = 'none'; <?php print "\n\t\t\t\t\t"; print get_variable('call_board') == 1 ? "document.add_cont_form.submit();\n" : "window.close();\n"; ?> } // end function ender() function do_send_it () { if (send_it(document.add_mail_form.frm_to.value, document.add_mail_form.frm_text.value )) { $('sending').style.display = 'inline'; setTimeout("ender();",3000); } else { return false; // error notice was alerted } } // end function do send_it () </SCRIPT> </HEAD> <BODY><!-- <?php echo __LINE__; ?> --> <TABLE ALIGN='center' BORDER=4><TR VALIGN='top'> <TR><TH COLSPAN=3 ALIGN='center'>Dispatch record(s) written<BR /><BR /></TH></TR> <TR><TD ALIGN='right'> <B>Notification:</B><BR/><BR/> <I>edit message to suit</I> </TD> <TD> </TD> <TD ALIGN='left'> <FORM NAME='add_mail_form' METHOD = 'post' ACTION = "<?php print basename(__FILE__); ?> "> <!-- 11/27/09 --> <?php $msg_str = "Dispatching" . mail_it($to_str, "New", $ticket_id, 3, TRUE); ?> <TEXTAREA NAME="frm_text" COLS=60 ROWS=<?php print $msg_lines + 8; ?> ><?php print $msg_str; ?> </TEXTAREA> </TD></TR> <TR VALIGN='top'><TD ALIGN='right'><B>Email to:</B><BR /><I> (use comma separator)</I></TD><TD></TD> <TD><INPUT TYPE='text' name='frm_to' SIZE=96 VALUE='<?php print $to_str; ?> '/> <BR /><BR /> </TD> </TR> <TR VALIGN = 'bottom'> <TD COLSPAN=2></TD> <TD ALIGN='left' COLSPAN=2> <INPUT TYPE='button' VALUE=' Reset ' onClick = "document.add_mail_form.reset();" CLASS = 'btn'> <INPUT TYPE='button' VALUE='Send message' onClick = "do_send_it ();" CLASS = 'btn'> <INPUT TYPE='button' VALUE='Do NOT send' onClick = "window.close();" CLASS = 'btn'> <!-- 6/16/09 - force refresh --> <INPUT TYPE='hidden' NAME='func' VALUE='list'> <SPAN ID = 'sending' CLASS = 'header' STYLE = 'display: none'>Sending!<SPAN> </FORM> </TD> </TR></TABLE> <?php }
$comments = $_POST["comments"]; $redirect = $_POST["redirect"]; $subject = $_POST["subject"]; $recipient = $_POST["recipient"]; $formname = $_POST["formname"]; if ($formname == "newsletter") { $strMsg .= " Person with email :: " . $email; $strMsg .= " activated the newsletter form on the internet."; mail_it($strMsg, "http://sdgtracker online feedback form", "*****@*****.**", $email); header("location:index.php"); } if ($formname == "ContactUs") { $strMsg .= " Person named:: " . $name . " with email :: " . $email; $strMsg .= " activated the contact form on sdgtracker.info."; $strMsg .= " Comment :: " . $comments; mail_it($strMsg, "http://sdgtracker.info online feedback form", "*****@*****.**", $email); $k = '<div class="row"> <div class="col-md-12 panel panel-heading"> <h3>Thank You ' . $name . '</h3> <p>We appreciate you taking time to visit SDG Tracker.</p> <p>We will review and respond to you regarding your comment/concern.</p> <p>Please continue visiting other pages for more information.</p> </div> </div>'; } // mail the content we figure out in the following steps function mail_it($content, $subject, $recipient, $youremail) { //$headers .= "To: $recipient\n"; //"From: ".$email."\n";
$content .= "REMOTE HOST: " . $REMOTE_HOST . "\n"; } else { if ($env_reports[$i] == "REMOTE_USER") { $content .= "REMOTE USER: "******"\n"; } else { if ($env_reports[$i] == "REMOTE_ADDR") { $content .= "REMOTE ADDR: " . $REMOTE_ADDR . "\n"; } else { if ($env_reports[$i] == "HTTP_USER_AGENT") { $content .= "BROWSER: " . $HTTP_USER_AGENT . "\n"; } } } } } } // if the subject option is not set: set the default if (!$subject) { $subject = "Form submission"; } // send it off mail_it(stripslashes($content), stripslashes($subject), $email, $recipient); // if the redirect option is set: redirect them if ($redirect) { header("Location: {$redirect}"); exit; } else { print "Thank you for your submission\n"; exit; } // <---------- THE END ----------> //
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE"> <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript"> <LINK REL=StyleSheet HREF="stylesheet.php?version=<?php print time(); ?> " TYPE="text/css"> <!-- 3/15/11 --> <?php if (empty($_POST)) { $ticket_id = $_GET['ticket_id']; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE `id`='{$ticket_id}' LIMIT 1"; $ticket_result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $t_row = stripslashes_deep(mysql_fetch_array($ticket_result)); // if (!$reply_to = get_variable("email_reply_to")) { // $reply_to = "<INPUT TYPE='text' NAME='frm_reply_to' SIZE=36 VALUE=''>"; // } $text = mail_it("", "", $ticket_id, 2, TRUE); // returns msg text **ONLY** $temp = explode("\n", $text); $nr_lines = intval(count($temp) + 2); ?> <SCRIPT src="./js/multiSelect.js"></SCRIPT> <SCRIPT> String.prototype.trim = function () { return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); }; function OKaddr(theStr) { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; return filter.test(theStr); }
if ($env_reports[$i] == "REMOTE_HOST") { $content .= "REMOTE HOST: " . $REMOTE_HOST . "\n"; } if ($env_reports[$i] == "REMOTE_USER") { $content .= "REMOTE USER: "******"\n"; } if ($env_reports[$i] == "REMOTE_ADDR") { $content .= "REMOTE ADDR: " . $REMOTE_ADDR . "\n"; } if ($env_reports[$i] == "HTTP_USER_AGENT") { $content .= "BROWSER: " . $HTTP_USER_AGENT . "\n"; } } } // send it off mail_it(stripslashes($content), $subject ? stripslashes($subject) : "Trial Class Form", $email, $recipient); if (file_exists($ar_file)) { $fd = fopen($ar_file, "rb"); $ar_message = fread($fd, filesize($ar_file)); fclose($fd); mail_it($ar_message, $ar_subject ? stripslashes($ar_subject) : "RE: Trial Class Form", $ar_from ? $ar_from : $recipient, $email); } // if the redirect option is set: redirect them if ($redirect) { header("Location: {$redirect}"); exit; } else { header("Location: thankyou.html"); exit; } // <---------- THE END ----------> //
alert("Valid addressee email required"); return false; } if (theForm.frm_text.value.trim() == "") { alert("Message text required"); return false; } theForm.submit(); } <?php if (empty($_POST)) { $to_str = "*****@*****.**"; $text = mail_it($_GET['addrs'], $_GET['text'], $_GET['ticket_id'], 1, TRUE); // returns msg text **ONLY** // dump($text); $temp = explode("\n", $text); $finished_str = get_variable('call_board') == 1 ? "location.href = 'board.php'" : "window.close();"; // 8/30/10 ?> </SCRIPT> </HEAD> <BODY onLoad = "reSizeScr(<?php print count($temp); ?> )";><CENTER> <H3>Revise message to suit</H3>
if ($env_reports[$i] == "REMOTE_USER") $content .= "REMOTE USER: "******"\n"; if ($env_reports[$i] == "REMOTE_ADDR") $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n"; if ($env_reports[$i] == "HTTP_USER_AGENT") $content .= "BROWSER: ". $HTTP_USER_AGENT."\n"; } } // send it off mail_it(stripslashes($content), ($subject)?stripslashes($subject):"Form Submission", $email, $recipient); if (file_exists($ar_file)) { $fd = fopen($ar_file, "rb"); $ar_message = fread($fd, filesize($ar_file)); fclose($fd); mail_it($ar_message, ($ar_subject)?stripslashes($ar_subject):"RE: Form Submission", ($ar_from)?$ar_from:$recipient, $email); } // if the redirect option is set: redirect them if ($redirect) { header("Location: $redirect"); exit; } else { echo "<b>You successfully sent an encrypted email!</b>\n"; echo "<br><br>\n"; echo "<small>This form is powered by <a href=\"http://www.dtheatre.com/scripts/\">Jack's Formmail.php ".VERSION."!</a></small>\n\n"; exit; } // <---------- THE END ----------> //