}
            }
        }
    }
    /*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;
    } else {
<?php 
$row = executeQuery_AR("SELECT tblperguntas.id, pergunta, resposta1, resposta2, resposta3, resposta4, numrespostacorreta, idfase FROM tblperguntas, interperguntafase WHERE tblperguntas.id = interperguntafase.idpergunta AND tblperguntas.id = " . $_SESSION["perguntas"]["id"] . ";");
$num = $row["numrespostacorreta"];
$numfase = $row["idfase"];
?>

<!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link href="/chuvaDeMilhoes/modules/css/administracao.css" rel="stylesheet" type="text/css" />
        	<script type="text/javascript" src="/chuvaDeMilhoes/modules/javascript/controle.js"></script>
        </head>    
    <body>
    	<form action="/chuvaDeMilhoes/administracao/indexNewDay.php" method="post" name="form">
             <div class="aviso">Alteração de Perguntas</div>
             	<table cellpadding="0" cellspacing="0" id="tablecadperg" border="0">
                	<tr>
                    	<td class="colcadperdtitle">Pergunta:</td>
                        <td>
                        	<textarea rows="5" cols="54" name="txtPergunta" id="txtPergunta"><?php 
echo $row["pergunta"];
?>
</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="colcadperdtitle">Resposta 1:</td>
                        <td>
                        	<input type="text" name="txtResposta1" value="<?php 
echo $row["resposta1"];
示例#3
0
        $_SESSION["partida"]["data"] = 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;
<?php 
$row = executeQuery_AR("SELECT * FROM tblfase WHERE id = " . $_SESSION["fase"]["id"] . ";");
$num = $row["numrespostacorreta"];
?>

<!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link href="/chuvaDeMilhoes/modules/css/administracao.css" rel="stylesheet" type="text/css" />
        	<script type="text/javascript" src="/chuvaDeMilhoes/modules/javascript/controle.js"></script>
        </head>    
    <body>
    	<form action="/chuvaDeMilhoes/administracao/indexNewDay.php" method="post" name="form">
             <div class="aviso">Alteração de Perguntas Bônus</div>
             	<table cellpadding="0" cellspacing="0" id="tablecadperg" border="0">
                	<tr>
                    	<td class="colcadperdtitle">Pergunta:</td>
                        <td>
                        	<textarea rows="5" cols="54" name="txtPergunta" id="txtPergunta"><?php 
echo $row["pergunta"];
?>
</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="colcadperdtitle">Resposta 1:</td>
                        <td>
                        	<input type="text" name="txtResposta1" value="<?php 
echo $row["resposta1"];
?>
if ($_SESSION["partida"]["id"] != null) {
    $_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"] = 0;
    $_SESSION["partida"]["tempototal"] = "00:00:00";
    $_SESSION["partida"]["acumulado"] = 0;
}
/* Obtem informações da fase em que o jogador se encontra */
$_SESSION["fase"] = executeQuery_AR("SELECT * FROM tblfase WHERE numfase like '" . $_SESSION["partida"]["fase"] . "';");
$_SESSION["fase"]["bonuscreditos"] = 0;
/* Seta o valor dos créditos gerados pelas telas de bônus */
switch ($_SESSION["fase"]["numfase"]) {
    case 1:
        $_SESSION["fase"]["bonuscreditos"] = 50;
        break;
    case 2:
        $_SESSION["fase"]["bonuscreditos"] = 75;
        break;
    case 3:
        $_SESSION["fase"]["bonuscreditos"] = 100;
        break;
}
$_SESSION["bonus"] = null;
$_SESSION["questoesEliminadas"][1] = "";
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;
    }
}