2. část scriptu:
echo "<center>\n";
if($_POST['toself'] == TRUE) {
array_push($validRecips, $_POST['senderEmail']);
}
$content = ($sendAsHtml == TRUE ? "text/html" : "text/plain");
$message = stripslashes($message);
if($sendAsHtml == 1) $message = $htmlHeader . nl2br(trim($message));
$headers = "From: " . $_POST['senderEmail'] . "\r\n";
$headers .= "X-Mailer: ".$locale['TF_003']."\r\n";
$headers .= "Content-Type: $content";
foreach($validRecips as $recip) {
$friends .= $recip . " ";
@mail($recip, $subject, $message, $headers);
echo $locale['TF_010']."$recip<br>\n";
}
echo "</center>\n<br>\n<center><b>".$locale['TF_011']."</b><br><br>\n\n";
if($useFooter) include($footerFile);
}
}
/* end main */
/* mixed */ function check_valid($list)
{
global $errorCode;
$numElements = sizeof($list);
$goodEmails = array();
foreach($list as $single) {
if(isValid($single)) {
$goodEmails[] = $single;
}
}
if(!empty($goodEmails)) {
return array_unique($goodEmails);
} else {
return FALSE;
}
}
/* void */ function show_form()
{
global $validRecips, $customMessage;
$senderEmail = (!isset($_GET['se']) ? $_POST['senderEmail'] : urldecode($_GET['se']));
//sender vars
echo "<form method='POST' action='".FUSION_SELF.(FUSION_QUERY ? "?".str_replace("&","&",FUSION_QUERY) : "")."'>\n
<input type='hidden' name='action' value='submit'>\n
<table border='0' align='center' cellpadding='1' cellspacing='0>'\n
<tr><td>E-mail odesílatele:</td></tr>\n
<tr><td><input class='textbox' style='width:150px' type='text' name='senderEmail' value='' size='10'></td></tr>\n
<tr><td>E-mail příjemce:</td></tr>\n
<tr><td><input class='textbox' style='width:150px' type='text' name='friend[]' value='' size='10'></td></tr>\n";
function selfURL1() {
$s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = strleft1(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft1($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}
echo "<tr><td><input class='textbox' name='customMessage' type='hidden' value='";
print($customMessage.(selfURL1()));
echo "'></td></tr>\n
<tr><td><input type='checkbox' name='toself'> Kopie odesílateli</td></tr>\n
<tr><td align='center'><input class='button' type='submit' value='Odeslat'></td></tr>\n
</table>\n
</form>\n";
}
/* bool */ function isValid($email)
{
return eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,4}$", $email);
}
closeside();