Sistema de indicação para múltiplos emails
Publicado por Perfil removido 17/11/2005
[ Hits: 8.521 ]
Este sistema de indicação permite o envio para mútiplos emails com validações.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Invite a friend</title>
<script type="text/javascript">
function dropFile(btn){
if(document.getElementById) {
tr = btn;
while (tr.tagName != 'TR') tr = tr.parentNode;
tr.parentNode.removeChild(tr);
checkForLast();
}
}
function addFile(btn){
if(document.getElementById) {
tr = btn;
while (tr.tagName != 'TR') tr = tr.parentNode;
var idSuffix = Math.round(Math.random()*1000);
var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
thisChilds = newTr.getElementsByTagName('td');
for (var i = 0; i < thisChilds.length; i++){
if (thisChilds[i].className == 'header') thisChilds[i].innerHTML = '';
if (thisChilds[i].className == 'text') thisChilds[i].innerHTML = '';
}
checkForLast();
}
}
function checkForLast(){
btns = document.getElementsByName('drop');
for (i = 0; i < btns.length; i++){
btns[i].disabled = (btns.length == 1) ? true : false;
}
}
function verify_form(form_invite){
if (form_invite.name_from.value == ""){
alert("Full your name");
form_invite.name_from.focus();
return (false);
}
if (form_invite.email_from.value == ""){
alert("Full your email");
form_invite.email_from.focus();
return (false);
}
return (true);
}
</script>
<style type="text/css">
body {
margin:20 auto;
text-align:center;
font:10px verdana, Arial, Helvetica, sans-serif;
color:#666;
}
.row_left {
float:left;
width:25%;
margin-top:4px;
padding:5px;
text-align:right;
}
.row_right {
float:left;
width:60%;
margin-top:4px;
padding:0px;
margin-left:4px;
text-align:left;
}
.all_screen {
float:left;
width:90%;
margin-top:4px;
padding:0px;
margin-left:4px;
text-align:center;
}
</style>
</head>
<body onload="window.resizeTo(500,445);" >
<form onsubmit="return verify_form(this)" name="form_invite" action="?status=result" method="post">
<?
function email($email){
if (ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email)){
return true;
}else{
return false;
}
}
if(isset($_GET["status"])) { $status = $_GET["status"]; } else { $status = '';}
if($status=='result') {
echo '<div class="all_screen"><p align="left">';
$name_from = $_POST['name_from'];
$email_from = $_POST['email_from'];
$name_to = $_POST['name_to'];
$email_to = $_POST['email_to'];
$msg = nl2br(strip_tags($_POST['msg']));
$n_friends = count($name_to);
$error = 0;
if ( empty($name_from) ) { echo " - Full your name<br />"; $error ++; }
if ( empty($email_from) ) { echo " - Full your email<br />"; $error ++; }
if ( !email($email_from)) { echo " - Full correctly your email<br />"; $error ++; }
if ( ($n_friends == 1) and (empty($email_to[0])) ) { echo " - Full your friends<br />"; $error ++;}
if ( $error != 0 ) { echo ' - <a href="javascript:history.go(-1)">Go back</a>'; } else {
echo 'Thank\'s '.$name_from.' to invite your friends to vistit our website.<BR /><BR />';
$subject = 'Indication';
$from = ''.$name_from.'< '.$email_from.' >';
for($i=0;$i<$n_friends;$i++){ $x = $i + 1;
if ((empty($name_to[$i])) or (empty($email_to[$i]))) { $this_mail = 'Don\'t send'; $this_status = 0; } else { $this_mail = 'Email sended correctly'; $this_status = 1;}
if (!email($email_to[$i])) { $this_mail = 'Don\'t send'; }
echo "$x - $name_to[$i] - $this_mail <br>";
if ($this_status == 0 ) { } else {
$email = $email_to[$i];
$msg_email = "Hello $name_to[$i], your friend $name_from send you a invite to visit our website and write this: <BR /><BR /> $msg <BR /><BR />www.eletronicparty.com";
@ mail ($email, $subject, $msg_email, "From: $from\nContent-type:text/html;charset=ISO-8859-1;MULTIPART/related");
}
} // close for
} // close else send email
echo '</p></div>';
} // close if status==result
?>
<div class="all_screen">
<label for="nome" class="row_left">Your name:</label>
<div class="row_right">
<input name="name_from" type="text" value="" size="38" maxlength="100" />
</div>
<div class="clear"> </div>
</div>
<div class="all_screen">
<label for="nome" class="row_left">Your email:</label>
<div class="row_right">
<input name="email_from" type="text" value="" size="38" maxlength="100" />
</div>
<div class="clear"> </div>
</div>
<div class="all_screen">
Write in this box a message to your friend(s).<br />
<textarea name="msg" style="width: 340px; height:100px;"></textarea>
</div>
<div class="all_screen">
Put down your friends ! Click in plus to add more a friend .
</div>
<div class="all_screen">
<table><tr><td>
Name <input type="text" size="15" name="name_to[]">
Email <input type="text" size="15" name="email_to[]">
<input type="button" name="drop" value="-" onClick="dropFile(this);" >
<input type="button" name="add" value="+" onClick="addFile(this);">
</td></tr></table>
</div>
<div class="all_screen">
<input type="submit" value="Send" name="Send" /></p><BR /><BR />
</div>
</form>
</body>
</html>
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Como instalar o repositório do DBeaver no Ubuntu
Como instalar o Plex Media Server no Ubuntu
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
Warcraft II Remastered no Linux? (2)
Linux é a solução para o fim do Windows10? [RESOLVIDO] (8)
Assinador JNLP do Site Portal da Nota Fiscal Eletrônica (0)









