<?php

session_start();
if (isset($_SESSION['user_name']) && isset($_SESSION['user_pswd'])) {
    ?>

<?php 
    require_once './EntidadeInterface.php';
    /*Incluir classe Banco_crud.php*/
    require_once './Banco_Crud.php';
    /*incluir classe Aluno.php*/
    require_once './Alunos.php';
    $obj_aluno_column = new Alunos();
    if (isset($_POST['Novo'])) {
        $nome_n = $_POST['nome_novo'];
        $nota_n = $_POST['nota_novo'];
        $obj_aluno_column = new Alunos();
        $obj_aluno_column->setNome($nome_n)->setNota($nota_n);
        $obj_banco_column = new banco_crud(include_once './conexao.php', $obj_aluno_column);
        $obj_banco_column->inserir_entity($obj_aluno_column->getNome(), $obj_aluno_column->getNota());
        header("Location:index.php?page=view_lista");
    }
} else {
    ?>
<p>Por favor realizar seu login no sistema!</p>
<br/><?php 
    echo '<body>' . '<table>' . '<tr>' . '<td>Ir' . '</td>' . '<td>Login' . '</td>' . '<td alingn=middle width=550><a href=index.php?page=login_user><input  type="submit" name="nome_lis" value="Click" ></a>' . '</td>' . '</tr>' . '</table>' . '</body>';
}
Ejemplo n.º 2
0
<?php

require_once 'Conecta.php';
require_once 'Alunos.php';
if (isset($_POST['enviar'])) {
    $nome = $_POST['nome'];
    $nota = $_POST['nota'];
    $alunos = new Alunos($conexao);
    $alunos->setNome($nome)->setNota($nota);
    if ($alunos->inserir()) {
        header("location:/");
    } else {
        echo "Falha na inserção do Registro";
    }
}
?>


<html>
    <head>
        <title>Alunos</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
    </head>
    <body>
        <div class="container">
            <h1 class="text-center">Gerenciamento de Alunos</h1>
            <h3 class="text-center">Inserir novo Aluno</h3>
            <hr />
            <form action="<?php