General Question
Why my "send to a friend form" only works in safari?
Please help me!!!
<?php
if(count($_POST)) {
foreach(array(‘friendmail1’,‘friendmail2’,‘friendmail3’,‘email’,‘name’,‘dia_hora’) as $key) $_POST[$key] = strip_tags($_POST[$key]);
if(!is_secure($_POST)) { die(“Seguridad”);}
$emailto = “info@mysite.com”;
$esubject = “Una recomendaciĆ³n del sitio web se ha realizado”;
$emailtext = ”
$_POST[name] ha utilizado el formulario: invite a sus amigos. Su e-mail es $_POST[email]. Y la fecha indicada para la reuniĆ³n fue: $_POST[dia_hora] .
Con las siguientes personas:
$_POST[friendmail1]
$_POST[friendmail2]
$_POST[friendmail3]
”;
@mail(”$emailto”, $esubject, $emailtext, “From: $_POST[email]”);
$thankyou = “thanks.html”;
$tsubject = ”$_POST[name] te recomienda mysite”;
$ttext = ”
hi
check this out http://www.mysite.com
Atte
Tu amigo(a),
$_POST[name]
$_POST[email]
”;
@mail(”$_POST[friendmail1],$_POST[friendmail2],$_POST[friendmail3]”, $tsubject, $ttext, “FROM: $_POST[email]”);
header(“Location: $thankyou”);
exit;
}
function is_secure($ar) {
$reg = ”/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i”;
if(!is_array($ar)) { return preg_match($reg,$ar);}
$incoming = array_values_recursive($ar);
foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
return true;
}
function array_values_recursive($array) {
$arrayValues = array();
foreach ($array as $key=>$value) {
if (is_scalar($value) || is_resource($value)) {
$arrayValues[] = $value;
$arrayValues[] = $key;
}
elseif (is_array($value)) {
$arrayValues[] = $key;
$arrayValues = array_merge($arrayValues, array_values_recursive($value));
}
}
return $arrayValues;
}
?>
1 Answer
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.