Esempio n. 1
0
 public static function addAluno()
 {
     $db = Atalhos::getBanco();
     if ($query = $db->prepare("SELECT idUser FROM tbUsuario WHERE email = ? or matricula = ?")) {
         $query->bind_param('si', $_POST['emailAluno'], $_POST['matAluno']);
         $query->execute();
         $query->bind_result($idUser);
         $query->store_result();
         $aux = $query->num_rows;
         $query->fetch();
         $query->close();
         //Colocar Aviso de Erro
         if ($aux == 0) {
             //Insere as Informações no Banco
             $nivel = 4;
             $status = "Ativo";
             $nome = strtoupper($_POST['nomeAluno']);
             //Insere informações do Aluno
             if ($query = $db->prepare("INSERT INTO tbUsuario (nome, email, senha, nivel, statusUser, matricula, dataInicio) VALUES (?, ?, AES_ENCRYPT(?, ?), ?, ?, ?, ?)")) {
                 $senha = Atalhos::gerar(10, 4, 6, 2);
                 $query->bind_param('ssssisis', $nome, $_POST['emailAluno'], $senha, $_SESSION['chave'], $nivel, $status, $_POST['matAluno'], date("Y-m-d"));
                 $query->execute();
                 $idUserAluno = $query->insert_id;
                 $query->close();
                 //Insere Na Tabela AlunoVinc
                 if ($query = $db->prepare("INSERT INTO tbAlunoVinc (idAluno, idReq) VALUES (?,?)")) {
                     $query->bind_param('ii', $idUserAluno, $_POST['req4']);
                     $query->execute();
                     $query->close();
                 }
                 $db2 = atalhos::getBanco();
                 if ($aux2 = $db2->prepare("SELECT a.nome, a.email, AES_DECRYPT(a.senha, ?), a.idNucleo, a.matricula, a.nivel, c.tituloReq, c.resumoReq, c.dataFim FROM tbUsuario a INNER JOIN tbAlunoVinc b on a.idUser = b.idAluno INNER JOIN tbRequerimento c on b.idReq = c.idReq WHERE a.idUser = ? AND a.statusUser = '******'")) {
                     $aux2->bind_param('si', $_SESSION['chave'], $idUserAluno);
                     $aux2->execute();
                     $aux2->bind_result($_SESSION['dados'][0], $email, $_SESSION['dados'][2], $_SESSION['dados'][3], $_SESSION['dados'][4], $_SESSION['dados'][5], $_SESSION['dados'][6], $_SESSION['dados'][7], $_SESSION['dados'][8]);
                     while ($aux2->fetch()) {
                         $nivel = 0;
                         $_SESSION['dados'][1] = $email;
                         $db1 = Atalhos::getBanco();
                         if ($admin = $db1->prepare("SELECT email FROM tbUsuario WHERE nivel = ?")) {
                             $admin->bind_param('i', $nivel);
                             $admin->execute();
                             $admin->bind_result($emailAux);
                             while ($admin->fetch()) {
                                 phpmailerAppException::enviarEmail($emailAux, 1);
                             }
                             $admin->close();
                         }
                         phpmailerAppException::enviarEmail($email, 3);
                     }
                     $aux2->close();
                 }
                 phpmailerAppException::enviarEmail($_POST['emailAluno'], 3);
             }
         } else {
             if ($query = $db->prepare("INSERT INTO tbAlunoVinc (idAluno, idReq) VALUES (?,?)")) {
                 $query->bind_param('ii', $idUser, $_POST['req4']);
                 $query->execute();
                 $query->close();
             }
         }
         $_SESSION['avisoAdicionar'] = 1;
     }
 }
Esempio n. 2
0
<?php

include "topo.php";
include "barra.php";
titulo("LCAD - Submeter Publicações");
if (!$_SESSION['logado'] || $_SESSION['nivel'] > 2) {
    //header('Location: /inicio');
}
$db = atalhos::getBanco();
$_SESSION['irPara'] = '/inicio';
if ($query = $db->prepare("SELECT idReuniao, dataReuniao, tituloReuniao, resumoReuniao, participantes FROM tbReunioes")) {
    $query->execute();
    $query->bind_result($id, $data, $titulo, $resumo, $participantes);
    $query->store_result();
}
?>
	<div class="content-wrapper">

    <!-- Main content -->
    <section class="content">
      <div class="box box-solid">
        <div class="box-header with-border">
          <i class="glyphicon glyphicon-plus"></i>
          <h3 class="box-title">Submeter Publicação</h3>
        </div><!-- /.box-header -->
        <!--<div class="box-body">
          <p class="text-muted"> Texto </p>
        </div>--><!-- /.box-body -->
      </div><!-- /.box -->
    	<!-- Default box para novas reuniões-->
        <div class="box" id="box">