function Main() { $usu = unserialize($_SESSION['usu']); $ins = new Instituicao(); $tpl = file_get_contents("tpl/aluno/index.html"); if ($_POST['txtSenha1'] && $_POST['txtSenha2']) { if ($_POST['txtSenha1'] == $_POST['txtSenha2']) { if (strlen($_POST['txtSenha1']) >= 6) { $usu->AlteraSenha(md5($_POST['txtSenha1']), "-999"); header("Location:aluno.php?msg=" . base64_encode("@lng[Sua senha foi alterada com sucesso]")); } else { header("Location:aluno.php?a=as&msg=" . base64_encode("@lng[A senha deve ter no mínimo 6 caracteres]")); } } else { header("Location:aluno.php?a=as&msg=" . base64_encode("@lng[As senhas não são iguais]")); } } $ins->setCodigo($usu->getCodigoInstituicao()); $ins->Carrega(); if ($_GET['msg']) { $tplmsg = file_get_contents("tpl/aluno/mensagem.html"); $tplmsg = str_replace('<!--mensagem-->', base64_decode($_GET['msg']), $tplmsg); $tpl = str_replace('<!--localmensagem-->', $tplmsg, $tpl); } $sNome = split(' ', $usu->getNome()); $tpl = str_replace("<!--NomeAluno-->", $sNome[0], $tpl); $tpl = str_replace("<!--NomeInstituicao-->", '<a target="_blank" href="http://' . $ins->getSite() . '">' . $ins->getNomeCompleto() . '</a>', $tpl); if ($_GET['a']) { switch ($_GET['a']) { case 'as': AlteraSenha($tpl); } } else { Principal($tpl, $usu); } }
/** * atualiza um registro da tabela * * @parametro InstituicaoMySql instituicao */ public function update(Instituicao $Instituicao) { $sql = "UPDATE {$this->table} SET nome = :nome, sigla = :sigla, cidade = :cidade, estado = :estado, site = :site, tipo = :tipo WHERE id_instituicao = :id"; $id = $Instituicao->getIdInstituicao(); $nome = $Instituicao->getNome(); $sigla = $Instituicao->getSigla(); $cidade = $Instituicao->getCidade(); $estado = $Instituicao->getEstado(); $site = $Instituicao->getSite(); $tipo = $Instituicao->getTipo(); $stmt = ConnectionFactory::prepare($sql); $stmt->bindParam(':id', $id); $stmt->bindParam(':nome', $nome); $stmt->bindParam(':sigla', $sigla); $stmt->bindParam(':cidade', $cidade); $stmt->bindParam(':estado', $estado); $stmt->bindParam(':site', $site); $stmt->bindParam(':tipo', $tipo); return $stmt->execute(); }