Enviado em 04/07/2016 - 18:34h
Boa noite...http://asparion.sytes.net/001.png
index.php
http://asparion.sytes.net/002.png
envia.php
http://asparion.sytes.net/003.jpg
<?php
mysql_connect("localhost", "aspar102_roberto", "235556") or die ("Conexão Falhou: ".mysql_error());
mysql_select_db("aspar102_teste") or die ("Seleção do Banco de dados falhou");
?>
<?php
// Função de Validação de Email
function validaEMAIL($email){
$mail_correcto = 0;
if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) {
if (substr_count($email,".")>= 1){
$term_dom = substr(strrchr ($email, '.'),1);
if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
$antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
$caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
if ($caracter_ult != "@" && $caracter_ult != "."){
$mail_correcto = 1;
}
}
}
}
}
if ($mail_correcto)
return true;
else
return false;
}
?>
<!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>Sistema de Newsletter</title>
<style type="text/css">
<!--
.imagemfnd{
background:url(http://img695.imageshack.us/img695/8752/imgj.gif) no-repeat;
width:550px;
height:137px;
}
.box{
color:#FFF;
padding-top:40px;
padding-left:20px;
}
.btnEnvia{
text-align:right;
padding-right:75px;
}
.classBTN{
background:#999;
color:#CCC;
border:1px dashed #000;
margin-top:3px;
}
#admin{
background:#CCC;
width:400px;
height:auto;
border:1px solid #666;
}
.title{ color:#FFF; font-family:Arial, Helvetica, sans-serif; font-size:20px; border-bottom:1px dashed #FFF; text-align:center; }
-->
</style>
</head>
<body>
<div class="imagemfnd">
<div class="box">
<form action="?c=1" method="post" name="MyForm" id="MyForm">
Seu Nome: <input type="text" name="nome" id="nome" size="60" maxlength="100" style="border:1px solid #CCC" onfocus="style.border='1px solid #960'" /><br>
<br>
Seu Email:
<input type="text" name="email" id="email" size="60" maxlength="100" style="border:1px solid #CCC" onfocus="style.border='1px solid #960'" />
<div class="btnEnvia">
<input type="submit" name="envia" value="Cadastrar" class="classBTN" />
</div>
</form>
</div>
</div>
<br />
<div id="admin">
<?php
$emailscad = mysql_num_rows(mysql_query("SELECT * FROM newsletter"));
?>
<div class="title">Contagem da Newsletter</div>
<div align="center">
<?php if($emailscad > "1"){ echo "Temos <b>$emailscad</b> Emails Cadastrados em Nossa Base de Dados."; }elseif($emailscad == 0){ echo "Nenhum Email Cadastrado." ;}elseif($emailscad == 1){ echo "Temos <b>$emailscad</b> Email Cadastrado em Nossa Base de Dados."; } ?> </div>
</div>
<br />
<div id="admin">
<?php
$emailscad = mysql_num_rows(mysql_query("SELECT * FROM newsletter"));
?>
<div class="title">Envio de Emails da Newsletter</div>
<div align="center">
<?php if($emailscad == "0"){
echo "Não Há Emails Cadastrados.";
}else{
echo "
<form name='form1' method='post' action='?c=2'>
Assunto:<br><input name='assunto' type='text' id='assunto' size='40'><br>Corpo do Email:<br><textarea name='corpo' id='corpo' cols='40' rows='10'></textarea><br>
<input type='submit' name='envia' id='envia' value='Enviar'><br><br>
</form>
";
}
?></div>
</div>
</body>
</html>
<?php
if($_GET['c'] == "1"){
$nome = htmlspecialchars(htmlentities(trim($_POST['nome'])));
$validacao = validaEmail(htmlspecialchars(htmlentities(trim($_POST['email']))));
$email = htmlspecialchars(htmlentities(trim($_POST['email'])));
if($nome != "" && $email != "" && $validacao == "1"){
mysql_query("INSERT INTO newsletter (nome, email, horaINC, dataINC) VALUES ('$nome','$email','".date('H:i:s')."','".date('d/m/Y')."')");
echo '<script> alert("Cadastro efetuado com Sucesso!"); </script>';
}else{
echo '<script> alert("Por Favor, Preencha todos os Campos Corretamente!"); </script>';
}
}
?>
<?php
if($_GET['c'] == "2"){
$s = mysql_query("SELECT nome, email FROM newsletter");
$assunto = htmlentities($_POST['assunto']);
$corpo = htmlentities($_POST['corpo']);
while($f = mysql_fetch_array($s)){
$email = $f['email'];
mail("$email", "$assunto", "$corpo");
}
}
?>
Customizar a Instalação do Linux Debian com Preseed
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
Um modo leve de ouvir/ver áudio/vídeo da internet em máquinas pererecas
Resolver algumas mensagens de erro do SSH
Instalar módulo de segurança do Banco do Brasil Warsaw do tipo .run
Linux Debian 11 Bullseye Reiniciando Sozinho (1)
Bora fazer um teste? mbti (11)
Possível Migração de windows para linux ???? (pc da empresa) (2)