Wie kan mij helpen om in het onderstaande script iets toe te voegen.
Dit script wordt gebruikt om gegevens via de e-mail te versturen maar ik zou heel graag willen dat er aan het begin van de e-mail dan tekst te zien is, net zoals aan het eind van de e-mail want daar komt dan netjes in te staan IP-adres en servertijd vanaf regel 66
Dit script wordt gebruikt om gegevens via de e-mail te versturen maar ik zou heel graag willen dat er aan het begin van de e-mail dan tekst te zien is, net zoals aan het eind van de e-mail want daar komt dan netjes in te staan IP-adres en servertijd vanaf regel 66
PHP:
<?php
error_reporting(0);
session_start();
include("bewerking.php");
function xmail ($email_address, $email_cc, $email_bcc, $email_from, $subject, $msg, $attach_filepath, $want_attach){
$b = 0;
$mail_attached = "";
$boundary = "000XMAIL000";
if (count($attach_filepath)>0 && $want_attach) {
for ($a=0;$a<count($attach_filepath);$a++) {
if ($fp=fopen($attach_filepath[$a],"rb")) {
$file_name=basename($attach_filepath[$a]);
$content[$b]=fread($fp,filesize($attach_filepath[$a]));
$mail_attached.="--".$boundary."\n"
."Content-Type: binary/octet-stream; name=\"$file_name\"\n"
."Content-Transfer-Encoding: base64\n"
."Content-Disposition: inline; filename=\"$file_name\"\n\n"
.chunk_split(base64_encode($content[$b]))."\n";
$b++;
fclose($fp);
};
}
$mail_attached .= "--".$boundary."\n";
$add_header ="MIME-Version: 1.0\n"."Content-Type: multipart/mixed; boundary=\"$boundary\"; Message-ID: <".md5($email_from).">";
$mail_content="--".$boundary."\n"."Content-Type: text/plain; charset=\"UTF-8\"\n"."Content-Transfer-Encoding: 8bit\n\n".$msg."\n\n".$mail_attached;
return mail($email_address, $subject, $mail_content, "From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc ."\nErrors-To: ".$email_from."\n".$add_header);
} else {
return mail($email_address, $subject, $msg, "From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc ."\nErrors-To: ".$email_from);
}
}
if(strtoupper($_POST['captchacode']) !== strtoupper($_SESSION['captcha_id'])) {
echo "<center><br><br><br>Onjuiste verificatie code. <A HREF='javascript:history.go(-1)'>Ga terug</a></center>.";
} else {
$sql = "SELECT * FROM ".$TABLES["FORMS"]." WHERE ID ='".$_REQUEST["id"]."'";
$sql_result = mysql_query ($sql, $connection ) or die ('request "De My SQL query kon niet worden uitgevoerd" '.$sql);
$OPTIONS = mysql_fetch_assoc($sql_result);
$TO = $OPTIONS["SEND_TO"];
$FROM = $OPTIONS["SEND_TO"];
$subject = $OPTIONS["SUBJECT"];
$redirect = $OPTIONS["THANK_YOU_PAGE"];
$MESSAGE_BODY = "";
$regexp='/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/';
$sql = "SELECT * FROM ".$TABLES["FORM_FIELDS"]."
WHERE FORM_ID = '".$_REQUEST["id"]."'
ORDER BY FIELD_ORDER ASC";
$sql_resultF = mysql_query ($sql, $connection ) or die ('request "De My SQL query kon niet worden uitgevoerd" '.$sql);
while ($FIELD = mysql_fetch_assoc($sql_resultF)) {
$temp = 'field'.$FIELD["ID"];
if($FIELD["FIELD_TYPE"]=="FileBox"){
$Files[] = 'field'.$FIELD["ID"];
$MESSAGE_BODY .= str_replace('"','"',stripslashes(utf8_decode($FIELD["TITLE"]))).": ".$_FILES['field'.$FIELD["ID"]]['name']."\r\n";
} else {
$MESSAGE_BODY .= str_replace('"','"',stripslashes(utf8_decode($FIELD["TITLE"]))).": ".stripslashes(($_REQUEST[$temp]))."\r\n";
if (preg_match($regexp, trim($_REQUEST[$temp]))) {
$FROM = trim($_REQUEST[$temp]);
};
}
};
$MESSAGE_FOOTER ="\r\n\r\n\r\n";
$access_ip = (getenv(HTTP_X_FORWARDED_FOR)) ? getenv(HTTP_X_FORWARDED_FOR) : getenv(REMOTE_ADDR);
$MESSAGE_FOOTER .="IP adres: $access_ip\r\n";
$MESSAGE_FOOTER .="Server tijd: ".date("j F Y, H:i ")."\r\n";
$MESSAGE_FOOTER .="";
if(count($Files)>0){
foreach($Files as $filename){
if (is_uploaded_file($_FILES[$filename]['tmp_name'])) {
if(move_uploaded_file($_FILES[$filename]['tmp_name'], $SETTINGS["uploadDir"].$_FILES[$filename]['name'])) {
chmod($SETTINGS["uploadDir"].$_FILES[$filename]['name'],0777);
$attach_filepath[] = $SETTINGS["uploadDir"].$_FILES[$filename]['name'];
};
};
}
$MESSAGE_BODY .= $MESSAGE_FOOTER;
xmail ($TO, '', '', $FROM, $subject, $MESSAGE_BODY, $attach_filepath, true);
header("Location: $redirect");
} else {
$mailheader = "From: $FROM\r\n";
$mailheader .= "Reply-To: $FROM\r\n";
$mailheader .= "Content-type: text/html; charset=UTF-8\r\n";
$MESSAGE_BODY .= $MESSAGE_FOOTER;
mail($TO, $subject, $MESSAGE_BODY, $mailheader) or die ("Failure");
header("Location: $redirect");
}
};
?>
Laatst bewerkt: