Esempio n. 1
0
function Remover_usuario($var)
{
    global $conexao;
    $comandoSql = "SELECT id_usuario FROM usuario WHERE userid = ?";
    $stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
    $stmt->bind_param('s', $var);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($id);
    if ($stmt) {
        while ($stmt->fetch()) {
            //carrega variavel
        }
    }
    $stmt->close();
    if (testaSeAdminOuNao() == 1 && $id != 1) {
        $comandoSql = "DELETE FROM usuario WHERE userid = ?";
        $stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
        $stmt->bind_param('s', $var);
        $stmt->execute();
        $stmt->close();
        $comandoSql = "DELETE FROM template WHERE userid = ?";
        $stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
        $stmt->bind_param('s', $var);
        $stmt->execute();
        $stmt->close();
        $comandoSql = "DELETE FROM remetente WHERE userid = ?";
        $stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
        $stmt->bind_param('s', $var);
        $stmt->execute();
        $stmt->close();
    }
}
Esempio n. 2
0
				</tr>
<?php 
        }
        $stmt->close();
    }
    ?>
			</table>
	</fieldset>
	<br/>
</div>

<a href="#novo_usuario"><div class="metodo" onclick="openclose_novo_usuario();">Novo usuário</div></a>
<div style="display:none;" id ="novo_usuario">

<?php 
    if (testaSeAdminOuNao() == 1) {
        ?>
	<fieldset>
		<legend>Criar novo usuário com permissão para enviar</legend>
		<br/>
		<form action="pp/incluir_usuario.php" method="post">
			<table>
				<tr class="trUP">
					<th width="20%">Usuário</th>
					<th width="20%">Senha</th>
					<th width="40%">e-mail</th>
					<th width="10%">Limite diário</th>
					<th width="10%">Ação</th>
				</tr>
				<tr class="trDOWN">
					<td><input style="background-color:rgba(0,0,0,0);" type="text" name="usuario" maxlength="50" required/></td>