initial commit
This commit is contained in:
63
rels/pes_usuarios.php
Normal file
63
rels/pes_usuarios.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if (session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
include("../conexao.php");
|
||||
adm_auth();
|
||||
include('../menu.php');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Pesquisar Usuários por Nome</title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/article.css">
|
||||
<link rel="stylesheet" href="../css/input.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $nav; ?>
|
||||
<article>
|
||||
<section class='center'>
|
||||
<h1>Pesquisar Usuários</h1>
|
||||
<form method="POST" action="">
|
||||
<label>Cliente: </label>
|
||||
<input type="text" name="nome" placeholder="Digite o nome do cliente:" size="30"><br><br>
|
||||
<input type="submit" class='buttons' name="SendPesqUser" value="Pesquisar">
|
||||
</form><br><br>
|
||||
|
||||
<?php
|
||||
$SendPesqUser = filter_input(INPUT_POST, 'SendPesqUser', FILTER_SANITIZE_STRING);
|
||||
if($SendPesqUser){
|
||||
$nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
|
||||
$nome = '%'.$nome.'%';
|
||||
$query = "SELECT * FROM consulta_usuarios WHERE nome_usuario LIKE ?";
|
||||
$stmt = $con->prepare($query);
|
||||
$stmt->bind_param('s',$nome);
|
||||
if($stmt->execute())
|
||||
{
|
||||
$row = $stmt->get_result();
|
||||
echo "<h2>".$row->num_rows." Resultado(s) para ".trim($nome,"%").": </h2>";
|
||||
$tipo = 'Erro!';
|
||||
while($res = $row->fetch_assoc())
|
||||
{
|
||||
if(strcmp($res['tipo_usuario'],'adm') == 0)
|
||||
{
|
||||
$tipo = 'Administrador';
|
||||
}
|
||||
else if(strcmp($res['tipo_usuario'],'com') == 0)
|
||||
{
|
||||
$tipo = 'Comum';
|
||||
}
|
||||
echo "<h2>N°: ".$res['login_id']."<br>Cliente: ".$res['nome_usuario'].", ".$tipo."<br></h2>";
|
||||
echo "<h3>Usuário: ".$res['usuario']."<br></h3>";
|
||||
echo "<hr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
</article>
|
||||
<?php echo $footer; ?>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user