Viewing file: cadastra_boletim.php (3.71 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include "load_ipanel.php";
require_once "recaptchalib.php";
// sua chave secreta
$secret = "6LcQUhYUAAAAAPVjMh2OeSXBcbsjhM7qPL57OJ_S";
// resposta vazia
$response = null;
// verifique a chave secreta
$reCaptcha = new ReCaptcha($secret);
// se submetido, verifique a resposta
if ($_POST["g-recaptcha-response"]) {
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
if ($response != null && $response->success) {
if ($_POST['action'] == "cadastro") {
$jornalista = new CadastroEmail();
$jornalista->nome = utf8_decode($_POST['nome']);
$jornalista->email = utf8_decode($_POST['email']);
$jornalista->telefone = utf8_decode($_POST['telefone']);
$jornalista->cidade = utf8_decode($_POST['cidade']);
$jornalista->dtCadastro = date("Y-m-d");
$jornalista->tipo = "Boletim";
$jornalista->save();
$msg = '<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Release</title>
<style type="text/css">
* {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
text-decoration:none;
}
#conteudo {
min-width:300px;
min-height:20px;
margin:auto;
}
#area-contato-email {
min-width:280px;
min-height:20px;
padding:10px;
border:1px #CCCCCC solid;
float:left;
}
.text-cinza-444444 {
color:#444444;
}
.text-cinza-444444-bold {
color:#444444;
font-weight:bold;
}
p {
line-height:18px;
}
</style>
</head>';
$msg.= '<body>
<div>
<a href="http://www.arpenpr.org.br">
<img src="http://www.arpenpr.org.br/images/logo.jpg" border="0" />
</a>
<p style="margin:0px;color:#444;"><strong>Cadastro de Jornalista - Site Irpen.org.br</strong></p><br/><br/></p>
<p style="margin:0px; color:#444;">';
$msg.= '<span style="color:#444; font-weight:bold">Nome: </span>'.utf8_decode($_POST['nome']).'<br/>';
$msg.= '<span style="color:#444; font-weight:bold">Email: </span>'.utf8_decode($_POST['email']).'<br/>';
$msg.= '<span style="color:#444; font-weight:bold">Telefone: </span>'.$_POST['telefone'].'<br/>';
$msg.= '<span style="color:#444; font-weight:bold">Cidade: </span>'.utf8_decode($_POST['cidade']).'<br/>';
$msg.= '<span style="color:#444; font-weight:bold">IP de Origem: </span>'.$_SERVER["REMOTE_ADDR"].'<br/>';
$msg.= '</p>';
$msg.= '</div>';
$msg.= '</body>';
$msg.= '</html>';
$email = new Email();
$email->addEmail("comunicacao@arpenpr.org.br");
$email->setAssunto("Cadastro - Boletins");
$email->setNomeRemetente("Site Irpen.org.br");
$email->setMensagem($msg);
$email->envia();
header("Location: /home");
}
}
if ($_POST['action'] == "cancelamento") {
$jornalistaCtrl = new GenericCtrl("CadastroEmail");
$jornalistas = $jornalistaCtrl->getObjectByField("email", $_POST['email']);
foreach ($jornalistas as $j) {
$j->delete();
}
}
header("Location: /home");
?>
|