initial commit
This commit is contained in:
69
cliente/cad_cliente.php
Normal file
69
cliente/cad_cliente.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
if(session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
include('../menu.php');
|
||||
?>
|
||||
<DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Cadastro de clientes </title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/forms.css">
|
||||
<link rel="stylesheet" href="../css/article.css">
|
||||
<link rel="stylesheet" href="../css/input.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
echo $nav;
|
||||
?>
|
||||
<article>
|
||||
<section class='center'>
|
||||
<a href="index.php">Listar</a>
|
||||
<?php if(isset($_SESSION['msg'])){?>
|
||||
<div class="msg">
|
||||
<?php echo $_SESSION['msg'];
|
||||
unset($_SESSION['msg']);?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<p><h1> Cadastro de clientes </h1></p>
|
||||
<hr>
|
||||
<form method="POST" action="inc_cliente.php">
|
||||
<h4>Informações Básicas</h4>
|
||||
<p>Nome: <input type="text" name="nome"></p>
|
||||
<p>Endereço: <input type="text" name="endereco"></p>
|
||||
<hr>
|
||||
<h4>Detalhes do Endereço</h4>
|
||||
<p>Complemento: <input type="text" name="complemento"></p>
|
||||
<p>Bairro: <input type="text" name="bairro"></p>
|
||||
<p>Cidade: <input type="text" name="cidade"></p>
|
||||
<p>Estado: <input type="text" name="estado"></p>
|
||||
<hr>
|
||||
<h4>Dados Pessoais</h4>
|
||||
<p>CEP: <input type="number" name="cep"></p>
|
||||
<p>CPF/CNPJ: <input type="number" name="cpf_cnpj"></p>
|
||||
<p>RG: <input type="number" name="rg"></p>
|
||||
<hr>
|
||||
<h4>Informações de Contato</h4>
|
||||
<p>Email: <input type="email" name="email" placeholder="exemplo@exemplo.com"></p>
|
||||
<p>Telefone: <input type="tel" name="telefone" placeholder="(XX)XXXX-XXXX"></p>
|
||||
<p>Celular: <input type="tel" name="celular" placeholder="(XX)XXXXX-XXXX"></p>
|
||||
<?php if(isset($_SESSION['tipo'])){
|
||||
if(strcmp($_SESSION['tipo'],'adm')==0){
|
||||
?>
|
||||
<p> Desejo criar usuário: <input type="checkbox" name="criarUsuario"></p>
|
||||
<?php }
|
||||
}?>
|
||||
<table class='input'>
|
||||
<td><input class='buttons' type="submit" value="Enviar"></td>
|
||||
<td><input class='buttons' type="reset" value="Limpar"></td>
|
||||
</table>
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
<?php
|
||||
echo $footer;
|
||||
?>
|
||||
</body>
|
||||
</html>
|
48
cliente/cad_user.php
Normal file
48
cliente/cad_user.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
?>
|
||||
<DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Cadastro de Usuário </title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/forms.css">
|
||||
<link rel="stylesheet" href="../css/article.css">
|
||||
<link rel="stylesheet" href="../css/input.css">
|
||||
</head>
|
||||
<body>
|
||||
<article>
|
||||
<section class='center'>
|
||||
<p><h1> Cadastro de Usuário </h1></p>
|
||||
<?php if(isset($_SESSION['msg'])){?>
|
||||
<div class="msg">
|
||||
<?php echo $_SESSION['msg'];
|
||||
unset($_SESSION['msg']);?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<hr>
|
||||
<form method="POST" action="inc_user.php">
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['tmp']))
|
||||
echo "<input type='hidden' name='cli_id' value=".$_SESSION['tmp'].">";
|
||||
?>
|
||||
<p> Usuário: <input type="text" name="usuario" required></p>
|
||||
<p> Senha: <input type="password" name="senha" required></p>
|
||||
<p> Tipo:
|
||||
<select name="tipo">
|
||||
<option value="adm">Administrador</option>
|
||||
<option value="com" selected="selected">Comum</option>
|
||||
</select></p>
|
||||
<table class='input'>
|
||||
<td><input class='buttons' type="submit" value="Enviar"></td>
|
||||
<td><input class='buttons' type="reset" value="Limpar"></td>
|
||||
</table>
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
31
cliente/del_cliente.php
Normal file
31
cliente/del_cliente.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("../conexao.php");
|
||||
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
$result = "SELECT * FROM tbclientes WHERE id='$id'";
|
||||
$resultado = mysqli_query($con, $result);
|
||||
$row = mysqli_fetch_assoc($resultado);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> EXCLUIR </title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="index.php"> Listar </a> <br>
|
||||
<h1> Excluir Cliente </h1>
|
||||
<?php
|
||||
if (isset($S_SESSION['msg'])) {
|
||||
echo $_SESSION['msg'];
|
||||
unset($_SESSION['msg']);
|
||||
}
|
||||
?>
|
||||
<form method="POST" action="proc_del_cliente.php">
|
||||
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
|
||||
<label> Cliente: </label>
|
||||
<input type="text" name="nome" value="<?php echo $row['nome']; ?>"><br><br>
|
||||
<input type="submit" value="Confirma exclusão">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
106
cliente/edit_cliente.php
Normal file
106
cliente/edit_cliente.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("../conexao.php");
|
||||
|
||||
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
$result = "SELECT * FROM tbclientes WHERE id = '$id'";
|
||||
$resultado = mysqli_query($con, $result);
|
||||
$row = mysqli_fetch_assoc($resultado);
|
||||
|
||||
$has_user = false;
|
||||
$login_id = NULL;
|
||||
$username = NULL;
|
||||
$tipo = NULL;
|
||||
|
||||
$sql = "SELECT login_id, usuario, tipo_usuario FROM consulta_usuarios WHERE nome_usuario = ?";
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bind_param('s', $row['nome']);
|
||||
if($stmt->execute())
|
||||
{
|
||||
$fetch = $stmt->get_result()->fetch_assoc();
|
||||
$has_user = is_array($fetch);
|
||||
if($has_user)
|
||||
{
|
||||
$login_id = $fetch['login_id'];
|
||||
$username = $fetch['usuario'];
|
||||
$tipo = $fetch['tipo_usuario'];
|
||||
}
|
||||
}
|
||||
$stmt->close();
|
||||
|
||||
include('../menu.php');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-br">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Editar Cliente </title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/forms.css">
|
||||
<link rel="stylesheet" href="../css/article.css">
|
||||
<link rel="stylesheet" href="../css/input.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
echo $nav;
|
||||
?>
|
||||
<article>
|
||||
<section class='center'>
|
||||
<a href="index.php">Listar</a>
|
||||
<?php if(isset($_SESSION['msg'])){?>
|
||||
<div class="msg">
|
||||
<?php echo $_SESSION['msg'];
|
||||
unset($_SESSION['msg']);?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<h1> Alteração - Cliente </h1>
|
||||
<form method="POST" action="proc_editar_cliente.php">
|
||||
<input type="hidden" name="id" value="<?php echo $row['id'];?>">
|
||||
|
||||
<h4>Informações Básicas</h4>
|
||||
<p>Nome: <input type="text" name="nome" value="<?php echo $row['nome'];?>"></p>
|
||||
<p>Endereço: <input type="text" name="endereco" value="<?php echo $row['endereco'];?>"></p>
|
||||
<hr>
|
||||
<h4>Detalhes do Endereço</h4>
|
||||
<p>Complemento: <input type="text" name="complemento" value="<?php echo $row['complemento'];?>"></p>
|
||||
<p>Bairro: <input type="text" name="bairro" value="<?php echo $row['bairro'];?>"></p>
|
||||
<p>Cidade: <input type="text" name="cidade" value="<?php echo $row['cidade'];?>"></p>
|
||||
<p>Estado: <input type="text" name="estado" value="<?php echo $row['estado'];?>"></p>
|
||||
<hr>
|
||||
<h4>Dados Pessoais</h4>
|
||||
<p>CEP: <input type="number" name="cep" value="<?php echo $row['cep'];?>"></p>
|
||||
<p>CPF/CNPJ: <input type="number" name="cpf_cnpj" value="<?php echo $row['cpf_cnpj'];?>"></p>
|
||||
<p>RG: <input type="number" name="rg" value="<?php echo $row['rg'];?>"></p>
|
||||
<hr>
|
||||
<h4>Informações de Contato</h4>
|
||||
<p>Email: <input type="email" name="email" value="<?php echo $row['email'];?>"></p>
|
||||
<p>Telefone: <input type="tel" name="telefone" value="<?php echo $row['telefone'];?>"></p>
|
||||
<p>Celular: <input type="tel" name="celular" value="<?php echo $row['celular'];?>"></p>
|
||||
<?php
|
||||
if(isset($_SESSION['tipo'])){
|
||||
if(strcmp($_SESSION['tipo'],'adm')==0){
|
||||
$_SESSION['tmp'] = $id;
|
||||
?>
|
||||
<hr>
|
||||
<h4>Informações de usuário -> <?php echo $username." : ".$tipo;?></h4>
|
||||
<?php if($has_user){?>
|
||||
<p><a class='button' href="../login/alt_user.php?id=<?php echo $login_id;?>">Desejo editar usuário</a>
|
||||
<a class='button' href="../login/rem_user.php?id=<?php echo $login_id;?>">Desejo remover usuário</a></p>
|
||||
<?php }else{?>
|
||||
<p><a class='button' href="cad_user.php">Desejo criar usuário</a></p>
|
||||
<?php }?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<table class='input'>
|
||||
<td><input class='buttons' type="submit" value="Salvar"></td>
|
||||
<td><input class='buttons' type="reset" value="Limpar"></td>
|
||||
</table>
|
||||
</section>
|
||||
</article>
|
||||
<?php echo $footer;?>
|
||||
</body>
|
||||
</html>
|
39
cliente/inc_cliente.php
Normal file
39
cliente/inc_cliente.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if(session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
$nome = (empty($_POST["nome"])) ? "": $_POST["nome"];
|
||||
$endereco = (empty($_POST["endereco"])) ? "": $_POST["endereco"];
|
||||
$complemento = (empty($_POST["complemento"])) ? "": $_POST["complemento"];
|
||||
$bairro = (empty($_POST["bairro"])) ? "": $_POST["bairro"];
|
||||
$cidade = (empty($_POST["cidade"])) ? "": $_POST["cidade"];
|
||||
$estado = (empty($_POST["estado"])) ? "": $_POST["estado"];
|
||||
$email = (empty($_POST["email"])) ? "": $_POST["email"];
|
||||
$cpf_cnpj = (empty($_POST["cpf_cnpj"])) ? "": $_POST["cpf_cnpj"];
|
||||
$rg = (empty($_POST["rg"])) ? "": $_POST["rg"];
|
||||
$telefone = (empty($_POST["telefone"])) ? "": $_POST["telefone"];
|
||||
$celular = (empty($_POST["celular"])) ? "": $_POST["celular"];
|
||||
$cep = (empty($_POST["cep"])) ? "": $_POST["cep"];
|
||||
$checkuser = isset($_POST["criarUsuario"]);
|
||||
include('../conexao.php');
|
||||
|
||||
$query = "INSERT INTO tbclientes (nome, endereco, complemento, bairro, cidade, estado, email, cpf_cnpj, rg, telefone, celular, cep) VALUES ('$nome','$endereco','$complemento','$bairro','$cidade','$estado','$email','$cpf_cnpj','$rg','$telefone','$celular', '$cep')";
|
||||
$resu = mysqli_query($con, $query);
|
||||
if ($tmp = mysqli_insert_id($con)) {
|
||||
$_SESSION['msg'] = "<p> Cliente cadastrado com sucesso</p>";
|
||||
if($checkuser == true)
|
||||
{
|
||||
$_SESSION['tmp'] = $tmp;
|
||||
header('Location: cad_user.php');
|
||||
}else
|
||||
header('Location: index.php');
|
||||
}
|
||||
else{
|
||||
$_SESSION['msg'] = "<p style='color:red;'> Cliente não cadastrado!</p>";
|
||||
header('Location: cad_cliente.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
mysqli_close($con);
|
||||
?>
|
49
cliente/inc_user.php
Normal file
49
cliente/inc_user.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
include('../conexao.php');
|
||||
$user = $_POST['usuario'];
|
||||
$senha = $_POST['senha'];
|
||||
$tipo = $_POST['tipo'];
|
||||
$id = $_POST['cli_id'];
|
||||
|
||||
if((strcasecmp($tipo,'ADM') !== 0) || (strcasecmp($tipo,'COM') !== 0))
|
||||
{
|
||||
// Verificar se usuário já existe
|
||||
$check = $con->prepare('SELECT usuario FROM consulta_usuarios WHERE usuario = ?');
|
||||
$check->bind_param('s',$user);
|
||||
$check->execute();
|
||||
$res = $check->get_result();
|
||||
$row = $res->fetch_assoc();
|
||||
if(!empty($row['usuario']))
|
||||
{
|
||||
$_SESSION['msg'] = "Nome de usuário em uso.";
|
||||
header('Location: cad_user.php');
|
||||
$check->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = $con->prepare('INSERT INTO login_usuarios(login,senha,tipo,id_cliente) VALUES (?, ?, ?, ?)');
|
||||
$hashp = password_hash($senha, PASSWORD_DEFAULT);
|
||||
$stmt->bind_param('ssss',$user,$hashp,$tipo,$id);
|
||||
if($stmt->execute()){
|
||||
$_SESSION['msg'] = "Usuário adicionado com Sucesso.";
|
||||
$stmt->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['msg'] = "Erro na hora de adicionar.";
|
||||
header('Location: cad_user.php');
|
||||
$stmt->close();
|
||||
}
|
||||
if(isset($_SESSION['tmp']))
|
||||
unset($_SESSION['tmp']);
|
||||
header('Location: index.php');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$_SESSION['msg'] = "Tipo de usuário inválido!";
|
||||
header('Location: cad_user.php');
|
||||
}
|
||||
?>
|
100
cliente/index.php
Normal file
100
cliente/index.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("../conexao.php");
|
||||
include_once("../menu.php");
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-br">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LISTA DE CLIENTES</title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/tables.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $nav;?>
|
||||
<section>
|
||||
<?php if(isset($_SESSION['msg'])){?>
|
||||
<div class="msg">
|
||||
<?php echo $_SESSION['msg'];
|
||||
unset($_SESSION['msg']);?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<a href="cad_cliente.php">Cadastrar</a><br>
|
||||
<h1> CLIENTES </h1>
|
||||
<table border="1" width="100%">
|
||||
<?php
|
||||
echo "<td>ID </td> <td> Nome</td> <td> Endereço </td> <td> Complemento </td> <td> Bairro </td> <td> Cidade </td> <td> Estado </td> <td> Email </td> <td> CPF/CNPJ </td> <td> RG </td> <td> Telefone </td> <td> Celular </td> <td> CEP </td> <td colspan='2'> Operações </td>";
|
||||
|
||||
$pagina_atual = filter_input(INPUT_GET,'pagina',FILTER_SANITIZE_NUMBER_INT);
|
||||
$pagina = (!empty($pagina_atual)) ? $pagina_atual : 1;
|
||||
|
||||
$qnt_result_pg = 15;
|
||||
|
||||
$inicio = ($qnt_result_pg * $pagina) - $qnt_result_pg;
|
||||
|
||||
$result_clientes = "SELECT * FROM tbclientes LIMIT $inicio, $qnt_result_pg";
|
||||
$resultado_clientes = mysqli_query($con, $result_clientes);
|
||||
while ($row = mysqli_fetch_assoc($resultado_clientes)) {
|
||||
if(strcasecmp($row['nome'],'ADMINISTRADOR') !== 0)
|
||||
{
|
||||
echo "<tr><td>" . $row['id'] . "</td><td> ";
|
||||
echo $row['nome'] ."</td><td>";
|
||||
echo $row['endereco'] . "</td><td>";
|
||||
echo $row['complemento'] . "</td><td>";
|
||||
echo $row['bairro'] . "</td><td>";
|
||||
echo $row['cidade'] . "</td><td>";
|
||||
echo $row['estado'] . "</td><td>";
|
||||
echo $row['email'] . "</td><td>";
|
||||
echo $row['cpf_cnpj'] . "</td><td>";
|
||||
echo $row['rg'] . "</td><td>";
|
||||
echo $row['telefone'] . "</td><td>";
|
||||
echo $row['celular'] . "</td><td>";
|
||||
echo $row['cep'] . "</td><td><a href='edit_cliente.php?id=". $row['id'] . "'>Editar</a>";
|
||||
echo "</td><td> <a href='del_cliente.php?id=". $row['id'] . "'>Excluir </a></td></tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$result_pg = "SELECT COUNT(id) AS num_result FROM tbclientes";
|
||||
$resultado_pg = mysqli_query($con, $result_pg);
|
||||
$row_pg = mysqli_fetch_assoc($resultado_pg);
|
||||
$quantidade_pg = ceil($row_pg['num_result'] / $qnt_result_pg);
|
||||
|
||||
$max_links = 2;
|
||||
$max_links = 2;
|
||||
echo "<a href='index.php?pagina=1'>Primeira</a> ";
|
||||
|
||||
$paginant = $pagina - 1;
|
||||
$pagprox = $pagina + 1;
|
||||
if($paginant >= 1)
|
||||
{
|
||||
echo "<a href='index.php?pagina=$paginant'><<</a> ";
|
||||
}
|
||||
|
||||
for($pag_ant = $pagina - $max_links; $pag_ant <= $pagina - 1; $pag_ant++){
|
||||
if($pag_ant >= 1){
|
||||
echo "<a href='index.php?pagina=$pag_ant'>$pag_ant</a> ";
|
||||
}
|
||||
}
|
||||
|
||||
echo "$pagina ";
|
||||
|
||||
for($pag_dep = $pagina + 1; $pag_dep <= $pagina + $max_links; $pag_dep++){
|
||||
if($pag_dep <= $quantidade_pg){
|
||||
echo "<a href='index.php?pagina=$pag_dep'>$pag_dep</a> ";
|
||||
}
|
||||
}
|
||||
|
||||
if($pagprox <= $quantidade_pg)
|
||||
{
|
||||
echo "<a href='index.php?pagina=$pagprox'>>></a> ";
|
||||
}
|
||||
|
||||
echo "<a href='index.php?pagina=$quantidade_pg'>Última</a>";
|
||||
?>
|
||||
</section>
|
||||
<?php echo $footer;?>
|
||||
</body>
|
||||
</html>
|
17
cliente/proc_del_cliente.php
Normal file
17
cliente/proc_del_cliente.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("../conexao.php");
|
||||
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
$result = "DELETE FROM tbclientes WHERE id='$id'";
|
||||
$resultado = mysqli_query($con, $result);
|
||||
|
||||
if (mysqli_affected_rows($con)) {
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Cliente excluido com sucesso!</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
$_SESSION['msg'] = "<p style='color:red;'>Cliente não foi excluido</p>";
|
||||
header("Location: edit_cliente.php?id=$id");
|
||||
}
|
||||
|
||||
?>
|
30
cliente/proc_editar_cliente.php
Normal file
30
cliente/proc_editar_cliente.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("../conexao.php");
|
||||
|
||||
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
$nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
|
||||
$endereco = filter_input(INPUT_POST, 'endereco', FILTER_SANITIZE_STRING);
|
||||
$complemento = filter_input(INPUT_POST, 'complemento', FILTER_SANITIZE_STRING);
|
||||
$bairro = filter_input(INPUT_POST, 'bairro', FILTER_SANITIZE_STRING);
|
||||
$cidade = filter_input(INPUT_POST, 'cidade', FILTER_SANITIZE_STRING);
|
||||
$estado = filter_input(INPUT_POST, 'estado', FILTER_SANITIZE_STRING);
|
||||
$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
|
||||
$cpf_cnpj = filter_input(INPUT_POST, 'cpf_cnpj', FILTER_SANITIZE_NUMBER_INT);
|
||||
$rg = filter_input(INPUT_POST, 'rg', FILTER_SANITIZE_NUMBER_INT);
|
||||
$telefone = filter_input(INPUT_POST, 'telefone', FILTER_SANITIZE_NUMBER_INT);
|
||||
$celular = filter_input(INPUT_POST, 'celular', FILTER_SANITIZE_NUMBER_INT);
|
||||
$cep = filter_input(INPUT_POST, 'cep', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
|
||||
$result = "UPDATE tbclientes SET nome='$nome', endereco='$endereco', complemento='$complemento', bairro='$bairro', cidade='$cidade', estado='$estado', email='$email', cpf_cnpj='$cpf_cnpj', rg='$rg', telefone='$telefone', celular='$celular', cep='$cep' WHERE id = '$id'";
|
||||
$resultado = mysqli_query($con, $result);
|
||||
|
||||
if(mysqli_affected_rows($con)){
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Cliente alterado com sucesso</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
$_SESSION['msg'] = "<p style='color:red;'>Cliente não foi alterado</p>";
|
||||
header("Location: edit_cliente.php?id=$id");
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user