Ik heb een probleem..
Een werkend script heb ik van de ene server (gehoost bij DeHeeg.nl) ook in gebruik genomen voor een andere site (gehoost bij KPN) alleen werkt hij op de nieuwe site (kpn) niet..
Het gaat over een contact form. op www.erbo.nl
hier onder het script:
<?php
$validReferrers = array('www.erbo.nl','erbo.nl','erbo.nl','');
$formAction['default'] = array(
'recipient' => '[email protected]',
'recipient_cc' => '',
'recipient_bcc' => '',
'subject' => 'Reactie vanaf de ERBO webite',
'redirect' => 'http://www.erbo.nl/html/bedankt.htm';,
'redirect02' => 'http://www.erbo.nl/html/mislukt.htm';,
'naam' => '',
'bedrijfsnaam' => '',
'adres' => '',
'postcode' => '',
'plaats' => '',
'telefoonnr' => '',
'email' => '',
'vraag' => '',
'required' => 'naam,adres,postcode,plaats,telefoonnr,vraag',
'format' => 'html',
'sesrep_max_items' => '11',
);
$disableFormRecipients = 1;
$pageHdr = "<html><head><style>td {font: x-small, arial, verdana;} h1 {font-size: medium;} .err {color: #000066; font-weight: bold;}</style></head><body><table width='500' align=center><tr><td>";
$pageFtr = "</td></tr>\n</body></html>";
$HTTP_REF = getenv('HTTP_REFERER');
$a = preg_replace("/https?:\/\//","",$HTTP_REF);
$a = explode("/",$a);
$a = array_shift($a);
if(!in_array($a,$validReferrers)) {
print "$pageHdr<p class=err>Invalid Referrer '$a'</p><p>Referrer mag script niet benaderen.<p>";
exit;
}
if(($_POST['form_action'] == '') || ($formAction[$_POST['form_action']]['recipient'] == '')) {
$fAIndex = 'default';
} else {
$fAIndex = $_POST['form_action'];
}
$recipient = (!$disableFormRecipients && ($_POST['recipient'] != '')) ? $_POST['recipient'] : $formAction[$fAIndex]['recipient'];
$subject = ($_POST['subject'] != '') ? $_POST['subject'] : $formAction[$fAIndex]['subject'];
$redirect = ($_POST['redirect'] != '') ? $_POST['redirect'] : $formAction[$fAIndex]['redirect'];
$redirect02 = ($_POST['redirect02'] != '') ? $_POST['redirect02'] : $formAction[$fAIndex]['redirect02'];
$email = ($_POST['email'] != '') ? $_POST['email'] : $formAction[$fAIndex]['email'];
$naam = ($_POST['naam'] != '') ? $_POST['naam'] : $formAction[$fAIndex]['naam'];
$recipient_cc = (!$disableFormRecipients && ($_POST['recipient_cc'] != '')) ? $_POST['recipient_cc'] : $formAction[$fAIndex]['recipient_cc'];
$recipient_bcc = (!$disableFormRecipients && ($_POST['recipient_bcc'] != '')) ? $_POST['recipient_bcc'] : $formAction[$fAIndex]['recipient_bcc'];
$format = ($_POST['format'] != '') ? $_POST['format'] : $formAction[$fAIndex]['format'];
$required = ($_POST['required'] != '') ? $_POST['required'] : $formAction[$fAIndex]['required'];
$sesrep_max_items = ($_POST['sesrep_max_items'] != '') ? $_POST['sesrep_max_items'] : $formAction[$fAIndex]['sesrep_max_items'];
$recipient_secured = ($_POST['recipient_secured'] != '') ? $_POST['recipient_secured'] : $formAction[$fAIndex]['recipient_secured'];
$a = explode("@",$recipient);
$a = array_pop($a);
if(!in_array($a,$validReferrers)) {
print "$pageHdr<p class=err>Invalid Recipient '$recipient'</p><p> Email address heeft geen toegang tot script.<p>";
exit;
}
$rccArray = explode(",",$recipient_cc);
$recipient_cc = '';
if($rccArray[0] != '') {
foreach($rccArray as $rcc) {
$a = explode("@",$rcc);
$a = array_pop($a);
if(in_array($a,$validReferrers)) {
$recipient_cc .= "$rcc,";
}
}
}
$recipient_cc = substr($recipient_cc,0,-1);
$rbccArray = explode(",",$recipient_bcc);
$recipient_bcc = '';
if($rbccArray[0] != '') {
foreach($rbccArray as $rbcc) {
$a = explode("@",$rbcc);
$a = array_pop($a);
if(in_array($a,$validReferrers)) {
$recipient_bcc .= "$rbcc,";
}
}
}
$recipient_bcc = substr($recipient_bcc,0,-1);
$a = explode(",",$required);
if($a[0] != '') {
foreach($a as $req) {
if($_POST[$req] == '') {
header("Location: $redirect02");
exit;
}
}
}
$htmlFormat = (strtolower(substr($format,0,1)) == 'h');
$msg = '';
if($htmlFormat) {
$msg = "<html><head><style>td {font: x-small, arial,verdana;} .fldname {font-weight:bold;font-size:x-small;} .flddata {font-size:x-small;} .tblhdr { font-size:x-small;font-weight:bold;color:#000066;background-color=#99ccff}</style></head><body>\n";
$msg .= "<table border=0 cellspacing=0 cellpadding=0 width=615>\n";
$msg .= "<tr><td colspan=3 class='tblhdr'>Vraag</td></tr>\n";
} else {
$msg = "Vraag\n\n";
}
$bl0 = '';
$bl1 = '';
$ld = ' ';
$el = "\n\n";
$credits = '';
if($htmlFormat) {
$bl0 = '<tr bgcolor=#FFFFFF><td class="fldname" valign=top>';
$bl1 = '<tr bgcolor=#FFFFFF><td class="fldname" valign=top>';
$ld = '</td><td> </td><td width=80% class="flddata">';
$el = "</td></tr>\n";
}
$i = 0;
foreach($_POST as $k => $v) {
if($htmlFormat) {
$v = str_replace("\n","<br>\n",$v);
}
if($i) {
$msg .= "$bl0$k:$ld$v$el";
} else {
$msg .= "$bl1$k:$ld$v$el";
}
$i = !$i;
}
$extraHeaders = "";
if($email != '') { $extraHeaders .= "From: \"".addslashes($naam)."\" <".$email.">\r\n"; }
if($naam != '') { $extraHeaders .= "Reply-To: $email\r\n"; }
if($htmlFormat == 'h') { $extraHeaders .= "Content-type: text/html\r\n"; }
if($recipient_cc != '') { $extraHeaders .= "Cc: $recipient_cc\r\n"; }
if($recipient_bcc != '') { $extraHeaders .= "Bcc: $recipient_bcc\r\n"; }
$success = 1;
$success = mail($recipient,$subject,$msg,$extraHeaders);
if(!$success && $onzinLoaded) {
log_event("Unsuccesful Email Attempt: $recipient");
}
header("Location: $redirect");
?>
Kan iemand mij vertellen hoe het mogenlijk is dat hij op de ene site wel werkt en op de andere site niet?
THX alvast...
313 views