Jump to content
Fórum Script Brasil
  • 0

Como fazer a ativação/desativação dos estatutos em PHP!


Quencyjones

Question

Olá a todos, chamo-me José Moreira e estou a realizar um curso de Desenvolvimento de Produtos Multimédia no qual pretendo um futuro nesta área que admiro muito, assim agradecia imenso a quem me possa ajudar a retira a seguinte dúvida:

 

- De que forma faço a ativação/desativação das  tabelas de StatusCliente.phpStatusLoja.php, StatusTemas.php e StatussubTemas.php não me está a dar para ativar/desativar o estado?Qual a solução?

 

Agradecia imenso a vossa ajuda  para esclarecer da melhor maneira esta dúvida.

 

 tenho os seguintes códigos e a base de dados em baixo:

reclamacao.html

	<!DOCTYPE html>
<html>
	<title>Acrescentar Cliente</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="css/w3.css">
	<body class="w3-content" style="max-width:1920px">
		<div class="w3-row">

			<div class=" w3-light-blue w3-container w3-center" style="height:100%">
				<div class="w3-padding-16">
					<img src="Asset 1.png" alt="logo" style="width:10%">
				</div>
				<div class="w3-container w3-light-blue w3-row w3-center"> 
					<a href="AdicionarReclamacao.php" class="w3-container w3-light-blue w3-center w3-block w3-hover-blue-grey w3-padding-16" >Reclamações</a> 
				</div>
				<div class="w3-container w3-row  w3-light-blue">
					<a href="Inserirfuncionario.html" class="w3-button w3-half w3-blue w3-block w3-hover-brown w3-padding-16">Funcionários</a>
					<a href="InserirLoja.html" class="w3-button w3-half w3-blue w3-block w3-hover-dark-grey w3-padding-16">Lojas</a>
				</div>
				<div class="w3-container w3-row w3-light-blue">
					<a href="InserirPais.html" class="w3-button w3-half w3-blue w3-block w3-hover-dark-grey w3-padding-16">Inserir de País</a>
					<a href="Status.html" class="w3-button w3-blue w3-half w3-block w3-hover-dark-grey w3-padding-16">Status</a>
				</div>
			
		<footer class="w3-container w3-panel w3-black w3-padding-16 w3-center">@ Sistema de Reclamações da Robotics Automotive</footer>
	</body>
</html>

 

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Formulário da Robotics Automotive</title>
    <style type="text/css">
        * { margin: 0; padding: 0; font-family:Arial; font-size:12pt;}
        #divCenter { 
                background-color: #2528BB; 
				opacity:0.90;
                width: 300px; 
                height: 300px; 
                left: 50%;
                margin: -130px 0 0 -130px; 
                padding:10px;
                position: absolute; 
                top: 30%; }
		.img-fundo {
				background-image: url("imagenssite/1x/azultecnologia.jpg");
				width: 100vw;
				height: 100vh;
				background-position: center; 
				background-repeat: no-repeat; 
				background-size:100%; 
				}
		a:link {
				color:red;
				}
		a:hover {
				color: orange;
				}
		p
				{
				color: white;
				}

    </style>
</head>
<body>
<div class="img-fundo">
    <div id="divCenter">
        <form id="formPost" method="post" action="login.php">
		<p align="center"><img src="Asset 1.png" alt="Logo Robotics Automotive" style="height:100px; width:px"></p>
		<br><br>
           <p align="center"><strong>Utilizador: </strong><input type="text" id="utilizador" name="utilizador" size="20"/><br/></p>
			<br>
            <p align="center"><strong>Password: </strong><input type="password" id="pw" name="pw" size="20"><br/></p>
			<br>
            <p align="center"><input value="Entrar" type="submit" style="height:30px; width:80px"/> </p>
			
        </form>
	<br>
	<p align="center"><a href="registo.html" target="_blank">Efetuar o Registo</a></p>
    </div>
	  
</div>
</body>
</html>
InserirLoja.html

<html>
	<head>
		<meta charset="UTF-8">
		<title>Inserção de Loja</title>
		<link rel="stysheet" href="css/w3.css">
	</head>
	<body class="w3-container w3-cyan" style="max-width:1920px">
		<form enctype="multipart/form-data" method="POST" action="LojaBD.php">
			<h1 class="w3-center">Inserir Loja</h1>
			<hr>
			<br>
			
			
			<div class="w3-row w3-container w3-blue">
			<p>Descrição da Loja:</p>
			<p><input type="text" name="desc_loja" size='50'></p>	
				</div>
				<div class="w3-row w3-container w3-blue">
			<p>Localização da Loja:</p>
			<p><input type="text" name="localizacao_loja" size='50'></p>
		
			<label>Selecione o estado da loja</label>
				<select id="estado_loja" name="estado_loja">
					<option value="0">Fechada</option>
					<option value="1">Aberta</option>
				</select>
				</div>
				<div class="w3-row w3-container w3-blue">
			<p>Contato da Loja:</p>
			<p><input class="w3-btn w3-half w3-pale-blue" type="text" name="contato_loja" size='10'></p>
			<p><input class="w3-btn w3-half w3-pale-blue" type="submit" value="Registar Loja"></p>
			</div>
		</form>
	</body>
</html>
InserirPais.html

<html>
	<head>
		<meta charset="UTF-8">
		<title>Inserção de Pais</title>
		<link rel="stylesheet" href="css/w3.css">
	</head>
	<body class="w3-container w3-cyan" style="max-width:1920px">
		<form enctype="multipart/form-data" method="POST" action="PaisBD.php">
			<h1 class="w3-center">Inserir Pais</h1>
			<hr>
			<div class="w3-row w3-container w3-blue">
			<p class="w3-text-white">Sigla do Pais:</p>
		
				<p><input type="text" id="sigla_pais" name="sigla_pais" size='30'></p>
			</div>
			<div class="w3-row w3-container w3-blue">
				<p class="w3-text-white">Insira a descrição:</p>
				<p><input type="text" id="desc_pais" name="desc_pais" size='30'></p>
			</div>
			
			<p><input class="w3-btn w3-half w3-pale-blue" type="submit" value="Registar Pais"></p>
			<p><a class="w3-btn w3-half w3-pale-blue" href="IntraOffice.html">Voltar ao inicio</a></p>
	
		</form>
	</body>
IntraOffice.html

<!DOCTYPE html>
<html>
	<title>Acrescentar Cliente</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="css/w3.css">
	<script language="JavaScript" type="text/javascript">
</script>
	<body class="w3-content" style="max-width:1920px">

			<div class=" w3-light-blue w3-container w3-center" style="height:100%">
				<div class="w3-padding-16">
					<img src="Asset 1.png" alt="logo" style="width:10%">
				</div>
			
				<div class="w3-container  w3-center w3-light-blue"> 
					<a href="AdicionarReclamacao.php" class="w3-container w3-center w3-block w3-hover-blue-grey w3-padding-16">Reclamações</a> 
				</div>
				<div class="w3-container w3-panel w3-light-blue">
					<a href="inserirfuncionario.php" class="w3-button w3-half w3-block w3-hover-brown w3-padding-16">Funcionários</a>
					<a href="InserirLoja.html" class="w3-button w3-half w3-block w3-hover-dark-grey w3-padding-16">Lojas</a>
				</div>
				<div class="w3-container w3-panel w3-light-blue">
					<a href="InserirPais.html" class="w3-button w3-half w3-block w3-hover-dark-grey w3-padding-16">Inserir de País</a>
					<a href="Status.html" class="w3-button w3-half w3-block w3-hover-dark-grey w3-padding-16">Status</a>
				</div>
			
		<footer class="w3-container w3-black w3-padding-16 w3-center">@ Sistema de Reclamações da Robotics Automotive</footer>
	</body>
</html>
Status.html

<html>
<head>
<meta charset="UTF-8">
<title>Status</title>
<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-blue" style="max-width:1920px">
    <h2 class="w3-margin w3-text-white">Selecione: </h2>
			
<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center">
    <p><a href="StatusUtilizadores.php">Estado de Utilizadores</a></p>
	</div>
	
	<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center ">
    <p><a href="StatusFuncionario.php">Estado de Funcionário</a></p>
	</div>
	
	<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center">
    <p><a href="StatusCliente.php">Estado Cliente</a></p>
	</div>

	<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center">
    <p><a href="StatusLoja.php">Estado Loja</a></p>
	</div>
	
	<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center">
    <p><a href="StatusTemas.php">Estado Temas</a></p>
	</div>
	
	<div class="w3-quarter w3-container w3-light-blue w3-margin w3-padding w3-center">
    <p><a href="StatussubTemas.php">Estado Subtemas</a></p>
	</div>
</body>
</html>

 

image.thumb.png.e4004383733fc74eb7318c63b0e81f6c.png

AdicionarReclamacao.php

<?php include 'conexao.php'; ?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Inserir Reclamação</title>
        <style type="text/css">
        textarea
            {
              border:1px solid #999999;
              width:100%;
              margin:5px 0;
              padding:3px;
              height: 100px
            }
        </style>
        
        <link rel="stylesheet" href="css/w3.css">
        <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
        <script language=javascript type="text/javascript">
            dayName = new Array ("domingo", "segunda", "terça", "quarta", "quinta", "sexta", "sábado")
            monName = new Array ("janeiro", "fevereiro", "março", "abril", "maio", "junho", "agosto", "outubro", "novembro", "dezembro")
            now = new Date
        </script>
    </head>
    <body>
    <div class="img-fundo">
        <div class=" w3-light-blue w3-container" style="height:100%">
            <form enctype="multipart/form-data" method="POST" action="AdicionarReclaBD.php">
            <div class="w3-center w3-border-bottom w3-blue w3-text-white">
          
            
            <script language=javascript type="text/javascript">
                document.write ("<h4>" + dayName[now.getDay() ] + ", " + now.getDate () + " de " + monName [now.getMonth() ]   +  " de "  +     now.getFullYear () + " </h4>")
            </script>
            
            <p> Hora atual: <a id='real-clock'>A carregar hora atual... </a></p>
                <h1>Inserir Reclamação</h1>
            </div>
            <div class="w3-panel w3-light-blue">
                <p>Código de Cliente:
				            <select name='id_cliente' id='id_cliente'  style="width:350px;">
							<option value="">Selecione...</option>
							<?php
								$result_cliente="SELECT id_cliente, NIF_cliente, nome_cliente FROM cliente WHERE estado_cliente='1'";
								$result=mysqli_query($ligar,$result_cliente);
								While($row_cliente = mysqli_fetch_assoc($result)){
									echo '<option value="'.$row_cliente['id_cliente'].'">'.$row_cliente['NIF_cliente'].' | '.$row_cliente['nome_cliente'].'</option>';
								}       
								?>
                            <p> </p>
                            </select>
</p>
            </div>
                <div class="w3-half w3-padding-32 w3-light-blue">
                    <div class="w3-margin">
                        <p class="w3-black w3-center">Tema:</p>
                            <label>Selecione um tema</label>
                            <select name='id_tema' id='id_tema'  style="width:350px;">
                                <option value="">Selecione...</option>
							<?php
								$result_tema="SELECT id_tema, des_tema FROM temas_reclamacao WHERE ativo_tema='1'";
								$result=mysqli_query($ligar,$result_tema);
								While($row_tema = mysqli_fetch_assoc($result)){
									echo '<option value="'.$row_tema['id_tema'].'">'.$row_tema['des_tema'].'</option>';
								}       
								?>
                            <p> </p>
                            </select>
                            <br><br>
                    </div>
                </div>
                <div class="w3-half w3-padding-32 w3-light-blue">
                    <div class="w3-margin">
                        <p class="w3-black w3-center">SubTema:</p>
                            <label>Selecione um subtema</label>            
                            <select name='id_subtema' id="id_subtema" style="width:350px;"> 
                            <option value="">Primeiro escolha um tema!</option>
                                </select>
                            <span class="Carregar" align="right" hidden>A carregar...</span>
                    </div>
                </div>
                <div class="container w3-padding-64 w3-panel w3-light-blue">
                <p class="w3-black w3-center">Texto da Reclamação:</p>
                <p>
                <label class="textareaContainer">
                    <textarea name="obs_assunto_reclam" width="100%" onfocus="this.value='';">Insira aqui a sua reclamação</textarea></p>
                </label>
                </div>
                <div class="w3-panel">
                <input class="w3-btn w3-third  w3-sand" type="submit" value="Registar Reclamação">
                <a class="w3-btn w3-third w3-gray">  </a>
                <a class="w3-btn w3-third  w3-sand" href="IntraOffice.html" target="_blank">Voltar</a>
                </div>
            </form>
        </div>        
    </div>
   	<script type="text/javascript">
    $(function(){
        $('#id_tema').change(function() {
            if($(this).val() ){
                    $('#id_subtema_reclam').hide(); //alterei para id_subtema_reclam como na base de dados
					$('#id_subtema_reclam').show();
                    $.getJSON('subtemas_post.php?search=',{id_tema: $(this).val(), ajax:'true'}, function(j){
                        var options='<option value="">Escolha um subtema</option>';
                        for (var i=0; i < j.length; i++){
                            options += '<option value="' + j[i].id + '">' + j[i].nome_subtema + '</option>';
                        }
                        $('#id_subtema_reclam').html(options).show();
                        $('.Carregar').hide();
                    });
            } else {
                $('#id_subtema_reclam').html('<option value="">- Selecione primeiro um tema -</option>');
            }
        });
    });
	
	var clock = document.getElementById('real-clock');
    setInterval(function () {
    clock.innerHTML = ((new Date).toLocaleString().substr(12, 8));  
	}, 1000);
	
	
	</script>

    </body>
</html>

image.thumb.png.25d8ca1413a541ce306dd55b7df79eae.pngimage.thumb.png.f350ca4a48051afb78e5ef0705ab3d84.pngimage.thumb.png.f338f4867f20d136bcf15b6a881f1013.pngimage.thumb.png.22821a15d39054bfbf52037bff54676f.pngimage.thumb.png.3ca21bd7b2b31a87160fd3372c9724e7.pngimage.thumb.png.99baf17620f626071b1b3437d629d1a2.pngimage.thumb.png.8284778b137e34d81b2bd26257a55961.pngimage.thumb.png.4e88212e922fb67375db285b2e64dc56.pngimage.thumb.png.7e8f1303d192509bf6ef2a3b4a8fb831.pngimage.thumb.png.2069ba18d19ac30998963891f1375e5d.pngimage.thumb.png.ba0e519905bbc1d568c58b332c89f139.pngimage.thumb.png.8af7336685a2b227415f833d699ffc64.png

StatusCliente.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado dos Clientes</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM cliente";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado dos utilizadores</h1></center>
<?php
echo"<center><h4>Total de Clientes em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM cliente ORDER BY idLogin";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadoFunc.php">
        <tr>
            <td>Id de Login</td>
            <td colspan="5"><?php echo $linha['idLogin'];?></td>
        </tr>
        <tr>
            <td>Nome do cliente</td>
            <td colspan="5"><?php echo $linha['nome_cliente'];?></td>
        </tr>
		<tr>
            <td>Email do cliente </td>
            <td colspan="5"><?php echo $linha['email_cliente'];?></td>
        </tr>
		<tr>
            <td>Contato do cliente </td>
            <td colspan="5"><?php echo $linha['contato_cliente'];?></td>
        </tr>
		<tr>
            <td>NIF do cliente </td>
            <td colspan="5"><?php echo $linha['NIF_cliente'];?></td>
        </tr>
		<tr>
            <td>Código Postal do cliente </td>
            <td colspan="5"><?php echo $linha['codpostal_cliente'];?></td>
        </tr>
		<tr>
            <td>Identificação do país</td>
            <td colspan="5"><?php echo $linha['id_pais'];?></td>
        </tr>
        <tr>
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['estado_cliente']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['idLogin'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

 

StatusFuncionario.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado de Funcionários</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM funcionario";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado de utilizador</h1></center>
<?php
echo"<center><h4>Total de Funcionários em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM funcionario ORDER BY idLogin";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadoUtil.php">
        <tr>
            <td>Id de Login </td>
            <td colspan="5"><?php echo $linha['idLogin'];?></td>
        </tr>
        <tr>
            <td>Id de Loja </td>
            <td colspan="5"><?php echo $linha['id_loja'];?></td>
        </tr>
		<tr>
            <td>Nome do Funcionário</td>
            <td colspan="5"><?php echo $linha['nome_func'];?></td>
        </tr>
        <tr>
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['ativo_func']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['idLogin'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

 

StatusLoja.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado das Lojas</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM loja";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado dos funcionários</h1></center>
<?php
echo"<center><h4>Total de lojas em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM loja ORDER BY id_loja";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadoFunc.php">
        <tr>
            <td>Descrição da Loja</td>
            <td colspan="5"><?php echo $linha['desc_loja'];?></td>
        </tr>
        <tr>
            <td>Localizaçáo da Loja</td>
            <td colspan="5"><?php echo $linha['localizacao_loja'];?></td>
        </tr>
		<tr>
            <td>Contato da loja</td>
            <td colspan="5"><?php echo $linha['contato_loja'];?></td>
        </tr>
		
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['estado_loja']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['id_loja'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

 

StatussubTemas.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado dos Subtemas</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM subtema_reclamacao";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado dos Temas</h1></center>
<?php
echo"<center><h4>Total de subtemas em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM subtema_reclamacao ORDER BY id_tema";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadotemas.php">
        <tr>
            <td>Id do tema</td>
            <td colspan="5"><?php echo $linha['id_tema'];?></td>
        </tr>
		<tr>
            <td>Descriçáo do subtema</td>
            <td colspan="5"><?php echo $linha['desc_subtema'];?></td>
        </tr>
        
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['ativo_subtema']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['ativo_subtema'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

 

StatusTemas.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado dos Subtemas</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM subtema_reclamacao";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado dos Temas</h1></center>
<?php
echo"<center><h4>Total de subtemas em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM subtema_reclamacao ORDER BY id_tema";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadotemas.php">
        <tr>
            <td>Id do tema</td>
            <td colspan="5"><?php echo $linha['id_tema'];?></td>
        </tr>
		<tr>
            <td>Descriçáo do subtema</td>
            <td colspan="5"><?php echo $linha['desc_subtema'];?></td>
        </tr>
        
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['ativo_subtema']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['ativo_subtema'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

 

StatusUtilizadores.php

<?php
include "conexao.php";
?>
<html>
<head>
    <title>Estado de Utilizadores</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="css/w3.css">
</head>
<body class="w3-content w3-light-blue" style="max-width:1920px">
<?php
$permissao='1';

 

$query="SELECT COUNT(*) FROM utilizadores";
$conn=mysqli_query($ligar, $query);
$result=mysqli_fetch_array($conn);
$total=$result[0];
?>
<center><h1>Alterar o estado de Funcionário</h1></center>
<?php
echo"<center><h4>Total de utilizadores em sistema: $total</h4></center>";
?>
<hr style="height:2px; border-width:0 color:grey">
<?php
$query2="SELECT * FROM utilizadores ORDER BY idLogin";
$conn2=mysqli_query($ligar, $query2);
while($linha=$conn2->fetch_assoc()){
    ?>
    <table width="550" border='0' align="center" cellspacing='0' cellpadding="2">
    <form method="POST" action="alterar_estadoFunc.php">
        <tr>
            <td>Id de Login </td>
            <td colspan="5"><?php echo $linha['idLogin'];?></td>
        </tr>
        <tr>
            <td>Login </td>
            <td colspan="5"><?php echo $linha['login'];?></td>
        </tr>
        <tr>
            <td>Permissão Atual</td>
            <td colspan="5"><?php 
            if($linha['status']==1)
                echo"Ativo";
            else echo"Inativo";            
            ?></td>
        </tr>
        <tr>
            <td align="center" colspan="6"><br><h4>::::Elaborar Alterações::::</h4></td>
        </tr>
        <tr>
            <td> Mudar Permissão: </td>
            <td><input type="radio" name="permissao" value="1">Ativo</td>
            <td><input type="radio" name="permissao" value="0">Inativo</td>
            <td colspan='3'>
            <label>
                <input name="id" type="hidden" value="<?php echo $linha['idLogin'];?>">
            </label>
            <label>
                <input name="submit" type="submit" value="Confirmar">
            </label>
            
        </tr>
    </table>
    <hr style="height:2px; border-width:0 color:grey">
    </form>
<?php } ?>
<br><br>
</body>

image.thumb.png.5905c5c6b4fbc3a788dd5e1426307a2e.png

 

 

image.thumb.png.cf34254bdf5e60c68e0a6b5525235402.png

 

image.thumb.png.60d10f7d63037cf9e5ada8fd2d7e7bd5.png

 

image.thumb.png.4e74436aef9e9bf4625efdbd4f3737e0.png

 

image.thumb.png.202efb485d4e48481181a17a5d890b67.png

 

image.thumb.png.fb4e44f6ad9b40340d57641a3dd2717c.png

 

image.thumb.png.7c6933fa03f10ba24959455bc638c251.png

 

image.thumb.png.57db47c21daf9309284dc4148e2c4feb.png

 

image.thumb.png.18c467462e4ffdd084f2fbabb57cad7a.png

 

image.thumb.png.b3fb6fcc540d456e2ebe82ad5d260bc8.png

 

image.thumb.png.8b7014943081fede54568a249f538798.png

 

image.thumb.png.2de426fdea56e5afc5a93708aac74f48.png

image.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Aqui só vou mudar o status dos clientes. Dos outros colaboradores, deixo para você.

StatusCliente.php

<body style="width:50%;margin:0 auto"><div style=height:5%></div>
<?php
$mysqli=new mysqli("localhost","root","","astudy");
if(isset($_GET['mudar'])){
    $id_cliente=$_GET['mudar'];
    if($_GET['status']==0){$novoStatus=1;} else {$novoStatus=0;}
    $query=$mysqli->query("update cliente set estado_cliente = $novoStatus 
        where id_cliente=$id_cliente");
    header("location:statuscliente.php");
}
$query=$mysqli->query("select * from cliente order by nome_cliente");
$total=$query->num_rows;
echo "<h1>Alterar o status dos utilizadores</h1>";
echo "<h4>Total de Clientes no sistema: $total</h4>";
echo "<table>";
while($row=$query->fetch_assoc()){
    foreach($row as $key=>$value){
        if($key=="estado_cliente"){
            if($value==0){$status="(inativo)";}else{$status="(ativo)";}
            echo "<tr style=color:red><td>$key<td>=> $value";
            echo "<a href=?mudar=".$row['id_cliente']."&status=$value> $status mudar status</a>"; } else {
        echo "<tr><td>$key<td>=> $value"; }
} echo "<tr style=height:15px><td>";
}

 

Screenshot_1.png

Edited by Frank K Hosaka
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...