コード例 #1
0
if (basename($_SERVER["PHP_SELF"]) == "cadastro.php") {
    die("Este arquivo não pode ser acessado diretamente.");
}
if (isset($_GET['id']) && !empty($_GET['id'])) {
    $codigoModuloEditar = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
    if (!($codigoModuloEditar = base64_decode($_GET['id']))) {
        $_SESSION["fatal-error"] = 'URL inconsistente.';
        header("Location: " . URL::getBase() . "system/modulos");
        exit;
    }
} else {
    $_SESSION["fatal-error"] = 'URL inconsistente.';
    header("Location: " . URL::getBase() . "system/modulos");
    exit;
}
$mysqli = conectabd(BD_PRINCIPAL);
//informações do usuario
if ($stmt = $mysqli->prepare("SELECT  nome, status, versao, icone, cor FROM modulo WHERE codigo = ? LIMIT 1")) {
    $stmt->bind_param('i', $codigoModuloEditar);
    $stmt->execute();
    // Execute the prepared query.
    $stmt->store_result();
    $stmt->bind_result($nomeModuloEditar, $statusModuloEditar, $versaoModuloEditar, $iconeModuloEditar, $corModuloEditar);
    $stmt->fetch();
}
?>

<ul class="breadcrumb">
    <li><a href="<?php 
echo URL::getBase();
?>
コード例 #2
0
ファイル: modulos.php プロジェクト: anderfilth/Painel-Workapp
function getApp($modulo)
{
    $mysqli = conectabd(BD_PRINCIPAL);
    if ($stmt = $mysqli->prepare("SELECT * FROM aplicativo WHERE codigo_modulo = ? ")) {
        $stmt->bind_param('i', $modulo);
        $stmt->execute();
        // Execute the prepared query.
        $stmt->store_result();
        return $stmt->num_rows;
    } else {
        return 0;
    }
}
コード例 #3
0
    die("Este arquivo não pode ser acessado diretamente.");
}
if (isset($_POST['uid'], $_POST['nome'], $_POST['senha'], $_POST['confirma'])) {
    // Sanitize and validate the data passed in
    $nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
    $uid = filter_input(INPUT_POST, 'uid', FILTER_SANITIZE_STRING);
    $senha = filter_input(INPUT_POST, 'senha', FILTER_SANITIZE_STRING);
    $confirma = filter_input(INPUT_POST, 'confirma', FILTER_SANITIZE_STRING);
    $error_msg = "";
    if (empty($uid) || empty($nome) || empty($senha) || empty($confirma)) {
        $error_msg = "Há campo vazio! <br>";
    } else {
        if ($senha != $confirma) {
            $error_msg = "Senha não confere <br>";
        }
        $mysqli = conectabd("workapp");
        $prep_stmt = "SELECT codigo FROM usuario WHERE uid = ? LIMIT 1";
        $stmt = $mysqli->prepare($prep_stmt);
        if ($stmt) {
            $stmt->bind_param('s', $uid);
            $stmt->execute();
            $stmt->store_result();
            if ($stmt->num_rows == 1) {
                // A user with this email address already exists
                $error_msg .= 'Já existe usuário cadastrado com esse UID <br>';
            }
        } else {
            $error_msg .= 'Houve erro relacionado ao banco de dados <br>';
        }
    }
    if (empty($error_msg)) {
コード例 #4
0
 protected function initialize()
 {
     $this->db = conectabd(BD_PRINCIPAL);
     parent::initialize();
     $this->db->close();
 }
コード例 #5
0
function getOrdem()
{
    $mysqli = conectabd(BD_PRINCIPAL);
    if ($stmt = $mysqli->prepare("SELECT count(*) FROM imagem_banner LIMIT 1")) {
        // Atribui "$user_id" ao parâmetro.
        //$stmt->bind_param('s', $campo);
        $stmt->execute();
        // Execute the prepared query.
        $stmt->store_result();
        if ($stmt->num_rows == 1) {
            // Caso o campo exista, pega o valor a partir do resultado.
            $stmt->bind_result($value);
            $stmt->fetch();
            return $value + 1;
        } else {
            // Retorna nada
            return 0;
        }
    } else {
        // Retorna nada
        return 0;
    }
}
コード例 #6
0
ファイル: header.php プロジェクト: anderfilth/Painel-Workapp
function carregaMenuModulo($user_id, $privilegio, $lastUrl)
{
    //carrega os menu dos modulos
    $mysqli = conectabd(BD_PRINCIPAL);
    if ($privilegio === 'administrador') {
        if ($stmt = $mysqli->prepare("SELECT codigo, nome, icone FROM modulo")) {
            $stmt->execute();
            // Execute the prepared query.
            $stmt->store_result();
            $stmt->bind_result($codigoModulo, $nomeModulo, $iconeModulo);
            if ($stmt->num_rows > 0) {
                while ($stmt->fetch()) {
                    ?>
			    <li>
				<a <?php 
                    if ($lastUrl === "{$codigoModulo}") {
                        echo 'class="active"';
                    }
                    ?>
 href="javascript:void(0);"><i class="fa fa-fw <?php 
                    echo $iconeModulo;
                    ?>
"></i><span class="title"> <?php 
                    echo $nomeModulo;
                    ?>
</span><span class="expand-sign">+</span></a>
				<ul>
				    <?php 
                    if ($stmt1 = $mysqli->prepare("SELECT id_file, nome, icone FROM aplicativo where codigo_modulo = ? ORDER BY ordem")) {
                        $stmt1->bind_param('i', $codigoModulo);
                        $stmt1->execute();
                        // Execute the prepared query.
                        $stmt1->store_result();
                        $stmt1->bind_result($id_fileApp, $nomeApp, $iconeApp);
                        if ($stmt1->num_rows > 0) {
                            while ($stmt1->fetch()) {
                                echo '
							<li>
							    <a href="' . URL::getBase() . 'modulos/' . $codigoModulo . '/' . $id_fileApp . '/" alt="' . $nomeApp . '" title="' . $nomeApp . '">' . $nomeApp . '</a>
							</li>
						    ';
                            }
                        }
                    } else {
                        echo '<li>Não foi possível buscar os aplicativos disponíveis!</li>';
                    }
                    ?>
				</ul>
			    </li>
			<?php 
                }
            } else {
                echo '<li>Não há nenhum módulo habilitado</li>';
            }
        }
    } else {
        $controleModerador = 0;
        $controleApp = 0;
        //carrega os menu dos modulos de acordo com a permissão do susuário
        if ($stmt = $mysqli->prepare("SELECT codigo, nome FROM modulo INNER JOIN modulo_permissao mp ON (mp.codigo_modulo = modulo.codigo) WHERE mp.codigo_usuario = ? AND `modulo`.`status` = 'ativo' ")) {
            $stmt->bind_param('i', $user_id);
            $stmt->execute();
            // Execute the prepared query.
            $stmt->store_result();
            $stmt->bind_result($codigoModulo, $nomeModulo);
            if ($stmt->num_rows > 0) {
                while ($stmt->fetch()) {
                    ?>
			    <li>
				<a <?php 
                    if ($lastUrl === "{$codigoModulo}") {
                        echo 'class="active"';
                    }
                    ?>
 href="javascript:void(0);"><i class="fa fa-fw fa-pencil-square-o"></i><span class="title"><?php 
                    echo $nomeModulo;
                    ?>
</span><span class="expand-sign">+</span></a>
				<ul>
				    <?php 
                    if ($stmt1 = $mysqli->prepare("SELECT id_file, nome, icone FROM aplicativo where codigo_modulo = ? ORDER BY ordem")) {
                        $stmt1->bind_param('i', $codigoModulo);
                        $stmt1->execute();
                        // Execute the prepared query.
                        $stmt1->store_result();
                        $stmt1->bind_result($id_fileApp, $nomeApp, $iconeApp);
                        if ($stmt1->num_rows > 0) {
                            while ($stmt1->fetch()) {
                                echo '
							<li>
							    <a href="' . URL::getBase() . 'modulos/' . $codigoModulo . '/' . $id_fileApp . '/" alt="' . $nomeApp . '" title="' . $nomeApp . '">' . $nomeApp . '</a>
							</li>
						    ';
                            }
                        }
                    } else {
                        echo '<li>Não foi possuível buscar os aplicativos disponíveis!</li>';
                    }
                    ?>
				</ul>
			    </li>
			<?php 
                }
                $controleModerador = $stmt->num_rows;
            }
        }
        if ($stmt = $mysqli->prepare("SELECT modulo.codigo, modulo.nome FROM modulo INNER JOIN aplicativo ap ON (ap.codigo_modulo = modulo.codigo) INNER JOIN aplicativo_direitos ad ON (ad.codigo_aplicativo = ap.codigo) WHERE ad.codigo_usuario = ? AND `modulo`.`status` = 'ativo' AND ap.status = 'ativo' ")) {
            $stmt->bind_param('i', $user_id);
            $stmt->execute();
            // Execute the prepared query.
            $stmt->store_result();
            $stmt->bind_result($codigoModulo, $nomeModulo);
            if ($stmt->num_rows > 0) {
                while ($stmt->fetch()) {
                    if ($stmt = $mysqli->prepare("SELECT * FROM modulo INNER JOIN modulo_permissao mp ON (mp.codigo_modulo = modulo.codigo) WHERE mp.codigo_usuario = ? AND modulo.codigo = ? AND `modulo`.`status` = 'ativo' ")) {
                        $stmt->bind_param('ii', $user_id, $codigoModulo);
                        $stmt->execute();
                        // Execute the prepared query.
                        $stmt->store_result();
                        if ($stmt->num_rows <= 0) {
                            ?>
				    <li>
					<a <?php 
                            if ($lastUrl === "{$codigoModulo}") {
                                echo 'class="active"';
                            }
                            ?>
 href="javascript:void(0);"><i class="fa fa-fw fa-pencil-square-o"></i><span class="title"><?php 
                            echo $nomeModulo;
                            ?>
</span><span class="expand-sign">+</span></a>
					<ul>
					    <?php 
                            if ($stmt1 = $mysqli->prepare("SELECT id_file, nome, icone FROM aplicativo where codigo_modulo = ? ORDER BY ordem")) {
                                $stmt1->bind_param('i', $codigoModulo);
                                $stmt1->execute();
                                // Execute the prepared query.
                                $stmt1->store_result();
                                $stmt1->bind_result($id_fileApp, $nomeApp, $iconeApp);
                                if ($stmt1->num_rows > 0) {
                                    while ($stmt1->fetch()) {
                                        echo '
								<li>
								    <a href="' . URL::getBase() . 'modulos/' . $codigoModulo . '/' . $id_fileApp . '/" alt="' . $nomeApp . '" title="' . $nomeApp . '">' . $nomeApp . '</a>
								</li>
							    ';
                                    }
                                }
                            } else {
                                echo '<li>Não foi possuível buscar os aplicativos disponíveis!</li>';
                            }
                            ?>
					</ul>
				    </li>
				<?php 
                        }
                    }
                }
                $controleApp = $stmt->num_rows;
            }
        }
        if ($controleModerador == 0 && $controleApp == 0) {
            echo '<li>Não há nenhum módulo habilitado</li>';
        }
    }
}