Ejemplo n.º 1
0
<?php

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Controle de jogadores e fichas de poker, na modalidade cash game. */
/*              Desenvolvido por: Reinaldo Silveira                  */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
include_once "../header.php";
require "../verifica.php";
include_once "../../model/class.ficha.php";
include_once "../../controller/class.ficha.php";
$ficha = new Ficha();
$acao = isset($_GET["acao"]) ? $_GET["acao"] : "";
$codigo = isset($_GET["id"]) ? $_GET["id"] : 0;
if ($codigo > 0) {
    if (!$ficha->buscar($codigo)) {
        echo "<script>\n                    alert('Registro não encontrado!');\n                    window.location = 'listagem.php';\n                  </script>";
        exit;
    }
}
if ($acao == "excluir" && $codigo > 0) {
    if ($ficha->excluir($codigo)) {
        echo "<script>window.location = 'listagem.php';</script>";
    } else {
        echo "<script>\n                    alert('Erro ao excluir o cadastro. Verifique as dependências e tente novamente.');\n                    window.location = 'listagem.php';\n                  </script>";
    }
}
if ($_POST) {
    if ($codigo == 0) {
        if ($ficha->incluir()) {
            echo "<script>window.location = 'listagem.php';</script>";
        } else {