Exemplo n.º 1
0
     executeQuery_NR("UPDATE interperguntafase SET idfase = " . $fase . " WHERE idpergunta = " . $idpergunta . ";");
     require "pages/pagPerguntas.php";
 } else {
     if (isset($_POST["btnalterarbonus"])) {
         $pergunta = $_POST["txtPergunta"];
         $resposta1 = $_POST["txtResposta1"];
         $resposta2 = $_POST["txtResposta2"];
         $respostacorreta = $_POST["comborespcorreta"];
         $idfase = $_POST["dados"];
         executeQuery_NR("UPDATE tblfase SET pergunta='" . $pergunta . "',resposta1='" . $resposta1 . "',resposta2='" . $resposta2 . "',numrespostacorreta=" . $respostacorreta . " WHERE id = " . $idfase . ";");
         require "pages/pagBonus.php";
     } else {
         if (isset($_POST["btnexcperguntas"])) {
             $idPergunta = $_POST["dados"];
             $SQL = "SELECT id FROM interperguntafase WHERE idpergunta = " . $idPergunta . ";";
             $idInterPerguntaFase = executeQuery_OR($SQL, "id");
             executeQuery_NR("DELETE FROM tblperguntas WHERE id = " . $idPergunta . ";");
             executeQuery_NR("DELETE FROM interperguntafase WHERE id = " . $idInterPerguntaFase . ";");
             require "pages/pagPerguntas.php";
         } else {
             if (isset($_POST["btnaltcreditos"])) {
                 $idUsuario = $_POST["dados"];
                 $creditos = $_POST["txtcredins"];
                 executeQuery_NR("UPDATE tblusuario SET creditos = " . $creditos . " WHERE id = " . $idUsuario . ";");
                 require "pages/pagInserirCreditos.php";
             } else {
                 if (isset($_POST["btnadmpergbonus"])) {
                     require "pages/pagBonus.php";
                 } else {
                     if (isset($_POST["btnadmfechamento"])) {
                         $_SESSION["data"] = "";
Exemplo n.º 2
0
                    $_SESSION["creditosfinais"] = (int) ($_SESSION["partida"]["creditosaida"] * 0.75);
                }
            }
        }
    }
    /*Redireciona para a página parar */
    pagina("Parar");
    exit;
}
/* Captura uma pergunta aleatória com base na fase do usuário */
$_SESSION["partida"]["idperguntafase"] = executeQuery_OR("SELECT interperguntafase.id FROM interperguntafase, tblfase, tblperguntas WHERE tblfase.id = interperguntafase.idfase AND tblperguntas.id = interperguntafase.idpergunta AND numfase = " . $_SESSION["fase"]["numfase"] . " ORDER BY RAND() LIMIT 1", "id");
/* Atualiza este id(Id da tabela que contém a referência para tabela fase e para tabela
	pergunta) na partida do usuário*/
executeQuery_NR("UPDATE tblpartida SET idperguntafase=" . $_SESSION["partida"]["idperguntafase"] . " WHERE id = " . $_SESSION["partida"]["id"] . ";");
/* Obtém as perguntas e respostas do jogo da base de dados */
$idPergunta = executeQuery_OR("SELECT tblperguntas.id FROM tblperguntas, interperguntafase, tblpartida WHERE tblpartida.idperguntafase = interperguntafase.id AND interperguntafase.idpergunta = tblperguntas.id AND tblpartida.idperguntafase = " . $_SESSION["partida"]["idperguntafase"], "id");
$_SESSION["pergunta"] = executeQuery_AR("SELECT * FROM tblperguntas WHERE id = " . $idPergunta);
/* Configura o número de aposta máxima conforme a correção
	Pois caso o usuário acertar a questão, o seu número automaticamente mudará, logo
	a correção se perpetuará para aposta máxima 
	Aposta Maxima = Aposta Minima + 20% da Aposta Minima * Numero da Fase
	*/
$_SESSION["partida"]["apostamaxima"] = 28 + 8 * $_SESSION["partida"]["questao"] * $_SESSION["fase"]["numfase"];
/* Caso o usuário deseje comprar mais tempo */
if (isset($_SESSION["bonus"]) && $_SESSION["bonus"] != null) {
    pagina("Bonus");
    exit;
} else {
    if (isset($_POST["btncomprar"])) {
        pagina("Comprar");
        exit;
<?php 
// Define o bome do botão de acordo com a situação da partida
if ($_SESSION["partida"]["id"] != "" || $_SESSION["partida"]["id"] != null) {
    // Verifica se a partida esta aberta
    $status = executeQuery_OR("SELECT status FROM tblpartida WHERE id = " . $_SESSION["partida"]["id"] . ";", "status");
    if ($status != 1) {
        $_SESSION["status"] = "Novo Jogo";
    } else {
        $_SESSION["status"] = "Continuar";
    }
} else {
    $_SESSION["status"] = "Novo Jogo";
}
?>

<!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link href="modules/css/principal.css" rel="stylesheet" type="text/css" />   
            <script type="text/javascript" src="/chuvaDeMilhoes/modules/javascript/controle.js"></script>     
        </head>    
    <body>
    	<form action="/chuvaDeMilhoes/index.php" method="post" name="form">
    	<div id="welcome"><span id="login"><?php 
echo $_SESSION["usuario"]["login"];
?>
</span>, <br/>Seja bem vindo <br/>ao</div>
        <img src="pages/img/logo.png" id="logo" alt="Chuva de Milhões o maior jogo de perguntas e respostas da Internet"/>
    	<div id="title">O maior jogo de perguntas <br/>e respostas da Internet</div>
        <div id="data"><?php 
Exemplo n.º 4
0
        $_SESSION["partida"]["questao"] = 1;
        $_SESSION["partida"]["tempototal"] = "00:00:00";
        $_SESSION["partida"]["acumulado"] = 0;
        pagina("Principal");
        exit;
    }
    /* Caso o usuário não possua mais créditos */
} else {
    if (isset($_POST["btninicio"])) {
        /* Obtem dados da ultima partia]da do jogador */
        $idPartida = executeQuery_OR("SELECT MAX(id) as idPartida FROM tblpartida WHERE idusuario = " . $_SESSION["usuario"]["id"] . ";", "idPartida");
        /* Caso o usuário seja novo no jogo, não terá uma partida criada na base de dados. Então
        			verifica-se, caso não tenha define os valores padrões */
        if ($idPartida != null) {
            $_SESSION["partida"] = executeQuery_AR("SELECT * FROM tblpartida WHERE id = " . $idPartida);
            $_SESSION["partida"]["fase"] = executeQuery_OR("SELECT numfase FROM tblpartida, interperguntafase, tblfase WHERE tblpartida.idperguntafase = interperguntafase.id AND interperguntafase.idfase = tblfase.id AND interperguntafase.id = " . $_SESSION["partida"]["idperguntafase"] . ";", "numfase");
        } else {
            // Define todos os valores como vázio
            $_SESSION["partida"]["id"] = "";
            $_SESSION["partida"]["fase"] = 1;
            $_SESSION["partida"]["creditoentrada"] = 0;
            $_SESSION["partida"]["creditoadd"] = 0;
            $_SESSION["partida"]["creditosaida"] = 0;
            $_SESSION["partida"]["data"] = 0;
            $_SESSION["partida"]["questao"] = 1;
            $_SESSION["partida"]["tempototal"] = "00:00:00";
            $_SESSION["partida"]["acumulado"] = 0;
        }
        pagina("Principal");
        exit;
    } else {
function verificaStatusJogo()
{
    /* Obtem dados da ultima partida do jogador */
    $_SESSION["partida"]["id"] = executeQuery_OR("SELECT MAX(id) as idPartida FROM tblpartida WHERE idusuario = " . $_SESSION["usuario"]["id"] . ";", "idPartida");
    /* Caso o usuário já tenha jogado uma partida entra na estrutura */
    if ($_SESSION["partida"]["id"] != "") {
        /* Obtem dados da ultima partia]da do jogador */
        $idPartida = executeQuery_OR("SELECT MAX(id) as idPartida FROM tblpartida WHERE idusuario = " . $_SESSION["usuario"]["id"] . ";", "idPartida");
        $_SESSION["partida"] = executeQuery_AR("SELECT * FROM tblpartida WHERE id = " . $idPartida);
        // Verifica se a partida esta aberta
        $status = executeQuery_OR("SELECT status FROM tblpartida WHERE id = " . $_SESSION["partida"]["id"] . ";", "status");
        // Caso o estado esteja igual a 1, significa que o usuário está jogando.
        if ($status == 1) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}