Mini Shell

Direktori : /home/sicomercio/public_html/adm/
Upload File :
Current File : /home/sicomercio/public_html/adm/mudacategoriaempresa.php

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
  
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<?

 // print_r($_GET);
 
 $cat = $_GET["cat"]; 
 $idempresa = $_GET["idempresa"]; 
 
 if(empty($cat))
 {

 }
 else
 {
 
 //$idempresa = base64_decode($idempresa);
  $cat = base64_decode($cat);
  
 




include"conexao.php";

// Check connection
if ($con->connect_error) {
    die("Connection failed: " . $con->connect_error);
} 

$sql = "INSERT INTO tab_emp_categ (id_empresa,id_categoria) VALUES  ('$idempresa','$cat')";
 //echo"$sql";



if ($con->query($sql) === TRUE) {
    echo "";
} else {
    echo "Error: " . $sql . "<br>" . $con->error;
}

$con->close();


  $or =  $_SERVER['HTTP_REFERER'];

print'<script type="text/javascript">
         parent.location.reload(true); 
</script>';
   

   echo"<script type='text/javascript'> 
    window.alert('SUCESSO!')
window.location='$or';

   </script>";










 exit();
 }

 
 





?>


<?php

echo"<center></br></br>";
   $id = $_GET["id"];
$id = base64_decode($id);


  // print_r($_GET);
   
 //  echo"$id";
   
include"conexao.php";
// conexão e seleção do banco de dados
$conn = mysqlI_connect($host, $user, $pass, $db);

// executa a consulta
  $sqll = "SELECT * FROM tab_emp_categ where id_empresa = '$id'";
 


$ress = mysqli_query($conn, $sqll);
 
// conta o número de registros
$total = mysqli_num_rows($ress);
 
 // echo "<p><div align = 'center' > $sqll $total </div></p>";
	
	//ECHO"$id_categoria |";
 
	
 
// loop pelos registros
while ($f = mysqli_fetch_array($ress))
{

$id_categoria = $f['id_categoria'];
$idcatapagar = $f['id'];

// include"conexao.php";
// conexão e seleção do banco de dados
$conn = mysqlI_connect($host, $user, $pass, $db);

// executa a consulta
$sqlll = "SELECT * FROM tab_categoria where id_categoria = '$id_categoria'";
$resss = mysqli_query($conn, $sqlll);
 
// conta o número de registros
$total = mysqli_num_rows($resss);
 
 // echo "<p><div align = 'center' > $total $sqlll </div></p>";
 
// loop pelos registros
while ($ff = mysqli_fetch_array($resss))
{
$categorianome = $ff['categoria'];

$categorianome = utf8_encode($categorianome); 
$categorianomee = $ff['categoria'];

$myArray[] = "$categorianomee";




echo"
 <label class=\"btn btn-danger\" style = 'font color:#FFFFFF;'><a href = \"apagacatdeempresa?id=$idcatapagar&empresa=$id\"onclick=\"return confirm('Confirma exclusão da categoria $categorianome da empresa?');\" ><font color = \"#FFFFFF\"><i class='fa fa-trash-o' style='font-size:18px'></i>  $categorianome </font></a></label>


";
 
}


}

$cat = "$myArray[0],$myArray[1],$myArray[2],$myArray[3],$myArray[4],$myArray[5],$myArray[6],$myArray[7],$myArray[8],$myArray[9],$myArray[10],$myArray[11],$myArray[12],$myArray[13],$myArray[14],$myArray[15],$myArray[16],$myArray[17],$myArray[18],$myArray[19],$myArray[20]";
  
  $cat = str_replace(",",", ",$cat ); 

$url = explode(", , ,", $cat);
$cat = $url[0];
$catt = $url[1];

  
  
  // print_r($myArray);



	//echo"$cat</br>  </br></br>";
// atualiza 
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

 
 $sql = "UPDATE tab_empresa SET categorianome = '$cat' WHERE id_empresa='$id' ";
 
 //echo"$sql";
if ($conn->query($sql) === TRUE) {

echo"";
} else {
echo "Error updating record: " . $conn->error;
}
// atualiza 
ECHO"</center></br></br></br>";







echo"<center>

<label>Categoria para incluir</br>";

print'
<select name="categoria" class="form-control  animated  bounceInUp"  style="width:180px; margin-bottom:10px" onChange="window.location.href = this.value;"> ';
echo"<option value=\"$id_situacao\" selected>$catempresa</option>";
$sqll = "SELECT * FROM tab_categoria where categoria <> '$catempresa' order by categoria ASC  ";
$ress = mysqli_query($con, $sqll);
$totall = mysqli_num_rows($ress);
 
while ($ff = mysqli_fetch_array($ress))
{
	
$novacat = $ff["categoria"];
$id_categoria = $ff["id_categoria"];
$novacat =  utf8_encode("$novacat");


// $id = base64_encode($id);
$id_categoria = base64_encode($id_categoria);
// $id = base64_encode($id);

echo"<option value=\"mudacategoriaempresa.php?cat=$id_categoria&idempresa=$id\">$novacat</option>";
}
 
print' </select>

</center>
';
?> 





Zerion Mini Shell 1.0