/administracao/campus/cadastrar.php

https://github.com/andrerezende/SIE · PHP · 53 lines · 48 code · 4 blank · 1 comment · 6 complexity · c0f2c6b866f910bb6b40a6a403336959 MD5 · raw file

  1. <?php session_start("SELECAO"); ?>
  2. <?php
  3. session_start();
  4. include("../classes/DB.php");
  5. include("../classes/Campus.php");
  6. $nome = addslashes($_POST['nome']);
  7. /* Acesso ao banco de dados */
  8. $banco = DB::getInstance();
  9. $conexao = $banco->ConectarDB();
  10. $campus = new Campus(null, $nome);
  11. $resultado = $campus->Inserir($conexao);
  12. if ($resultado == true) {
  13. $_SESSION['flashMensagem'] = 'Campus cadastrado com sucesso.';
  14. } else {
  15. $_SESSION['flashMensagem'] = 'Problemas ao efetuar o transa&ccedil;&atilde;o.';
  16. }
  17. header('Location:../login/menu.php');
  18. ?>
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20. <html lang="pt-br" xmlns="http://www.w3.org/1999/xhtml">
  21. <head>
  22. <title> <?php echo ($_SESSION["Gnomeprocessoseletivo"]);?> </title>
  23. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  24. <link href="../../estilo_selecao.css" rel="stylesheet" type="text/css" />
  25. <script type="text/javascript">
  26. function delayer(){
  27. window.location = '../login/login.php';
  28. }
  29. </script>
  30. </head>
  31. <body onload="setTimeout('delayer()', 1000)">
  32. <?php
  33. if ($resutado == true) {
  34. echo("<table width='90%' border='0'>");
  35. echo(" <tr>");
  36. echo(" <td height='280'><div align='center'><font size='6'><a href='../login/menu.php'>Cadastro efetuado com sucesso</font><font size='6'></font></div></td>");
  37. echo(" </tr>");
  38. echo("</table>");
  39. } else {
  40. echo("<table width='90%' border='0'>");
  41. echo(" <tr>");
  42. echo(" <td height='280'><div align='center'><font size='6'><a href='../login/menu.php'>Problemas ao efetuar o cadastro</font><font size='6'></font></div></td>");
  43. echo(" </tr>");
  44. echo("</table>");
  45. }
  46. $banco->DesconectarDB($conexao);
  47. ?>
  48. </body>
  49. </html>