function processaLink($idPalestra, $nomePalestra, $link) { $cadastroBD = new CadastroBD(); $info = new stdClass(); $info->palestra = $idPalestra; $info->ip = $_SERVER['REMOTE_ADDR']; if (!isset($_SESSION['controle'])) { if ($cadastroBD->registraDownload($info)) { $controle = new stdClass(); $controle->controle = true; $controle->{$nomePalestra} = true; $_SESSION['controle'] = $controle; header("Location: {$link}"); } else { echo "Erro ao baixar o arquivo, tente novamente mais tarde."; } } else { $controle = $_SESSION['controle']; if (!isset($controle->{$nomePalestra})) { if ($cadastroBD->registraDownload($info)) { $controle->{$nomePalestra} = true; $_SESSION['controle'] = $controle; header("Location: {$link}"); } else { echo "Erro ao baixar o arquivo, tente novamente mais tarde."; } } else { header("Location: {$link}"); } /*header("Content-Type: application/pdf"); // informa o tipo do arquivo ao navegador header("Content-Length: ".filesize($arquivo)); // informa o tamanho do arquivo ao navegador header("Content-Disposition: inline; ".basename($arquivo)); readfile($arquivo);*/ } }
if (isset($_SESSION['logado']) && $_SESSION['logado'] != null) { $retorno->logado = 1; $cadastroBd = new CadastroBD(); $data = new DateTime(); $retorno->dados->totalChecks = $cadastroBd->getTotalChecks($data); } echo json_encode($retorno); } else { if ($acao == 'login') { if ($_POST) { $ra = isset($_POST['ra']) ? $_POST['ra'] : null; $senha = isset($_POST['senha']) ? $_POST['senha'] : null; $retorno = new stdClass(); $retorno->mensagem = ""; $retorno->erro = ""; $cadastroBd = new CadastroBD(); try { if ($cadastroBd->checkLogin($ra, $senha) == 1) { session_start(); $_SESSION['logado'] = $ra; $retorno->mensagem = "Login efetuado com sucesso!"; } else { $retorno->erro = "RA e/ou senha inválido!"; } } catch (Exception $ex) { $retorno->erro = $ex->getMessage(); } echo json_encode($retorno); } } else { session_start();
<?php include_once "../cadastro/BancoDadosBase.php"; include_once "../cadastro/CadastroBD.php"; if ($_POST) { $retorno = new stdClass(); $retorno->mensagem = ""; $retorno->dados = null; $retorno->erro = ""; //$retorno->nome = "Jeferson"; //$retorno->email = "*****@*****.**"; $cadastroBD = new CadastroBD(); $min = $cadastroBD->idMin(); $max = $cadastroBD->idMax(); while (true) { $num = rand($min, $max); $sorteado = $cadastroBD->sorteia($num); if ($sorteado != null) { $from = "срутщъэѓєѕњќчСРУТЩЪЭгдекмЧ"; $to = "aaaaeeiooouucAAAAEEIOOOUUC"; if ($cadastroBD->checaSorteado($sorteado->id)) { if ($cadastroBD->salvaSorteado($sorteado->id)) { $retorno->nome = strtr($sorteado->nome, $from, $to); $retorno->email = strtr($sorteado->email, $from, $to); break; } else { $retorno->erro = "Erro ao salvar sorteado"; break; } } }
<?php include_once "../cadastro/BancoDadosBase.php"; include_once "../cadastro/CadastroBD.php"; if ($_POST) { $ra = isset($_POST['ra']) ? $_POST['ra'] : null; $confirmacao = (isset($_POST['confirmacao']) ? $_POST['confirmacao'] : 1) == 0 ? 0 : 1; $retorno = new stdClass(); $retorno->mensagem = ""; $retorno->dados = null; $retorno->erro = ""; $cadastroBd = new CadastroBD(); try { $ok = true; if ($ra != null) { $idCadastro = $cadastroBd->chamada($ra, $confirmacao); if ($idCadastro == 0) { $ok = false; } if ($confirmacao == 1 && $ok) { $retorno->dados = $cadastroBd->consultarCadastro($idCadastro); } else { if ($ok) { $retorno->mensagem = "Chamada realizada com sucesso!"; } } } if (!$ok) { $retorno->erro = "Houve um erro ao realizar a chamada, verifique se o RA está correto!"; } } catch (Exception $ex) {
<?php require_once "../../cadastro/BancoDadosBase.php"; require_once "../../cadastro/CadastroBD.php"; require_once "class.phpmailer.php"; $cadastroBD = new CadastroBD(); $pessoas = $cadastroBD->consultaNomeEmail(); foreach ($pessoas as $p) { if ($p->email == '*****@*****.**') { mandaBala($p->nome, $p->email); } } function mandaBala($nome, $email) { //PHPMailer Object $mail = new PHPMailer(); //From email address and name $mail->From = "*****@*****.**"; $mail->FromName = "CompuFAJ"; //To address and name $mail->addAddress($email, $nome); //Address to which recipient will reply //$mail->addReplyTo("*****@*****.**", "Reply"); //CC and BCC //$mail->addCC("*****@*****.**"); //$mail->addBCC("*****@*****.**"); //Send HTML or Plain Text email $mail->isHTML(true); $mail->Subject = "CompuFAJ - Material palestrantes"; $mail->Body = "\n <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n <html xmlns='http://www.w3.org/1999/xhtml'>\n <head>\n <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n <title>Material CompuFAJ</title>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'/>\n <table cellpadding='0' cellspacing='0' width='100%'>\n <td align='center'>\n <a href='http://compu.faj.br/material'><img src='http://compu.faj.br/material/email/imagem.jpg' alt='Material CompuFAJ' /></a>\n <br /><br />\n Caso não consiga visualizar este E-mail <a href='http://compu.faj.br/material/email/email.html'>clique aqui</a>\n </td>\n\n </table>\n </head>\n </html>\n "; //$mail->AltBody = "This is the plain text version of the email content";