Mini Shell

Direktori : /home/sicomercio/domains/sicomerciomppa.com.br/public_html/adm/
Upload File :
Current File : /home/sicomercio/domains/sicomerciomppa.com.br/public_html/adm/editarempresa.php

<?php 
include"menu.php";
?>

<? 


 

 

 if($_POST){
//  print_r($_POST);
  
  
$id_usuario = $_POST["id_usuario"];
$id = $_POST["id"];
$situacao = $_POST["situacao"];

$razaosocial = $_POST["razaosocial"];
$razaosocial = utf8_decode($razaosocial);

$fantasia = $_POST["fantasia"];
$fantasia = utf8_decode($fantasia);

$cnpj = $_POST["cnpj"];
$inscricao_estadual = $_POST["inscricao_estadual"];

$email = $_POST["email"];
$tel_com1 = $_POST["tel_com1"];
$tel_com2 = $_POST["tel_com2"];
$cidade = $_POST["cidade"];
$logradouro = $_POST["logradouro"];
$bairro = $_POST["bairro"];
$numero = $_POST["numero"];
$complemento = $_POST["complemento"];
$cep = $_POST["cep"];
$site = $_POST["site"];
 $tipo = $_POST["tipo"];
  $or = $_POST["or"];
  $categoria = $_POST["categoria"];
 $logradouro = utf8_decode($logradouro); 
   $categoria = utf8_decode($categoria); 
  
 $numero = utf8_decode($numero); 
$bairro = utf8_decode($bairro); 
$complemento = utf8_decode($complemento); 
 
 
  
  
  
  $id = base64_decode($id);


include"conexao.php";
  
  
  
  // Create connection
$conn = new mysqli($host, $user, $pass, $db);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

 $idd = base64_decode($idd); 
$sql = "UPDATE tab_empresa SET 
id_situacao = '$situacao',
cnpj = '$cnpj',
fantasia = '$fantasia',
razao_social = '$razaosocial',
inscricao_estadual = '$inscricao_estadual',
email = '$email',
tel_com1 = '$tel_com1',
tel_com2 = '$tel_com2',
cidade = '$cidade',
logradouro = '$logradouro',
complemento = '$complemento',
numero = '$numero',
 bairro = '$bairro',
 cep = '$cep',
  site = '$site',
    tipo = '$tipo'
	
	
	
  WHERE id_empresa='$id' ";
  
if ($conn->query($sql) === TRUE) {
  echo"<script type=\"text/javascript\" language=\"\">  alert(\"SALVO COM SUCESSO!\"); </script>";
  
	 
} else {
      echo "Error updating record: " . $conn->error;
	  print'<script type="text/javascript" language="">  alert("OCORREU UM ERRO!"); </script>';
}

$conn->close();
    

  
// echo"$sql";
 
 



$con->close();
 
 
 $or = base64_decode($or);

  echo"  <script> history.go(-2); </script> ";


/*
 echo "<script>

window.location='$or';
</script>";
 
*/


/*
 
 echo"<script type='text/javascript'> 
  window.open(\"empresas.php?id=$id_usuario\",\"_parent\");
   </script>";
  
 */
exit();
}








$or = $_GET["or"]; 
$id = $_GET["id"]; 
$id = base64_decode($id);


 
$sql = "select * from tab_empresa where id_empresa = '$id'";
$res = mysqli_query($con, $sql);
$total = mysqli_num_rows($res);
 
while ($f = mysqli_fetch_array($res))
{
$razao_social = $f['razao_social'];
$razao_social = utf8_encode($razao_social); 

$fantasia = $f['fantasia'];
$fantasia = utf8_encode($fantasia); 
$inscricao_estadual = $f['inscricao_estadual'];

$tel_com1 = $f['tel_com1'];
$tel_com2 = $f['tel_com2'];
$site = $f['site'];
$email = $f['email'];
$logradouro= $f['logradouro'];
$numero = $f['numero'];
$complemento = $f['complemento'];
$bairro = $f['bairro'];
$cidade = $f['cidade'];
$cep = $f['cep'];
$tipo = $f['tipo'];
$cnpj = $f['cnpj'];
$id_situacao = $f['id_situacao']; 
$id_usuario = $f['id_usuario']; 
$categoria = $f['categoria']; 

$numero = utf8_encode($numero); 
$bairro = utf8_encode($bairro); 
$complemento = utf8_encode($complemento); 
$logradouro = utf8_encode($logradouro); 


switch ($id_situacao)
{
case "1":
$nomesit = "Ativo";
break;

case "2":
$nomesit = "Bloqueado";
break;


case "3":
$nomesit = "Inativo";
break;
 
}


}
 

$id = base64_encode($id);
$id_usuario = base64_encode($id_usuario);
$logradouro = utf8_encode($logradouro);
$categoria = utf8_encode($categoria);
?>


<form name="form1" action="editarempresa.php" method="post" >
  <div align="center">
<input type="hidden" name="id"  value = "<? echo $id ;?>">
<input type="hidden" name="or"  value = "<? echo "$or" ;?>">

<input type="hidden" name="id_usuario"  value = "<? echo $id_usuario ;?>"  class = "form-control animated  bounceInleft " placeholder=" CELULAR" style="width:180px; margin-bottom:10px">


<label style = "margin-right:15px;" >
Razão Social</br>
<input type="text" name="razaosocial" value = "<? echo $razao_social;?>" size="30"  class = "form-control animated  bounceInleft " placeholder=" RAZÃO SOCIAL" style="width:180px; margin-bottom:10px">
</label>

<label style = "margin-right:15px;" >
Nome Fantasia</br>
<input type="text" name="fantasia"  size="30" value = "<? echo $fantasia;?>"  class = "form-control animated  bounceInleft " placeholder=" NOME FANTASIA" style="width:180px; margin-bottom:10px">
</label>

	  
<label style = "margin-right:15px;" >
CNPJ</br>
<input type="text" name="cnpj"  size="30"  value = "<? echo $cnpj ;?>" class = "form-control animated  bounceInleft " placeholder="CNPJ" style="width:280px; margin-bottom:10px">
</label>


 <label style = "margin-right:15px;" >
Inscrição Estadual</br>
<input type="text" name="inscricao_estadual"  value = "<? echo $inscricao_estadual ;?>" size="30"  class = "form-control animated  bounceInleft " placeholder="Inscrição Estadual" style="width:280px; margin-bottom:10px">
</label>

</br>

<label style = "margin-right:15px;" >
E-mail </br> 
 <input type="email" name="email"  size="30" value = "<? echo $email ;?>"  class = "form-control animated  bounceInleft " placeholder=" EMAIL" style="width:180px; margin-bottom:10px">
</label>



<label style = "margin-right:15px;" >
Telefones </br>  
<input type="text" name="tel_com1"  size="20" value = "<? echo $tel_com1 ;?>"  class = "form-control animated  bounceInleft " placeholder="1º TELEFONE" style="width:180px; margin-bottom:10px">
</label>
<label>
	 <input type="text" name="tel_com2" value = "<? echo $tel_com2 ;?>"  size="20"  class = "form-control animated  bounceInleft " placeholder="2º TELEFONE" style="width:180px; margin-bottom:10px">
</label>
 
</br>

<label style = "margin-right:15px;" >
Cidade </br>  
    <select name="cidade" required class="form-control  animated  bounceInUp"  style="width:180px; margin-bottom:10px">
          
<? 

 echo"<option value=\"$cidade\" selected>$cidade</option>";

$sql = "SELECT * FROM cidades where cidade <> '$cidade'  ";
$res = mysqli_query($con, $sql);
$total = mysqli_num_rows($res);
 
while ($f = mysqli_fetch_array($res))
{
$cidadee = $f["cidade"];

echo"<option value=\"$cidadee\">$cidadee</option>";
}













print'</select>';


?>
</label>


<label style = "margin-right:15px;" >
logradouro </br> 
 <input type="text" name="logradouro"  size="30"  value = "<? echo $logradouro ;?>"   class = "form-control animated  bounceInleft " placeholder="Logradouro" style="width:280px; margin-bottom:10px">
</label>

<label style = "margin-right:15px;" >
Complemento </br> 
 <input type="text" name="complemento"  size="30" value = "<? echo $complemento ;?>"    class = "form-control animated  bounceInleft " placeholder="Complemento" style="width:280px; margin-bottom:10px">
</label>


<label style = "margin-right:15px;" >
Número </br> 
 <input type="text" name="numero"  size="30" value = "<? echo $numero ;?>"    class = "form-control animated  bounceInleft " placeholder="número" style="width:80px; margin-bottom:10px">
</label>

<label style = "margin-right:15px;" >
Bairro </br> 
 <input type="text" name="bairro"  size="30" value = "<? echo $bairro ;?>"    class = "form-control animated  bounceInleft " placeholder="Bairro" style="width:180px; margin-bottom:10px">
</label>

		
<label style = "margin-right:15px;" >
CEP </br> 
 <input type="text" name="cep"  size="30"   value = "<? echo $cep ;?>"   class = "form-control animated  bounceInleft " placeholder="CEP" style="width:100px; margin-bottom:10px">
</label>

</br>

<label style = "margin-right:15px;" >
Situação </br>  
            <select name="situacao" required class="form-control  animated  bounceInUp" placeholder="Situação" style="width:180px; margin-bottom:10px">
          

<?
echo"<option value=\"$id_situacao\" selected >$nomesit</option>";

$sql = "SELECT * FROM tab_situacao where id_situacao <> '$id_situacao' ";
$res = mysqli_query($con, $sql);
$total = mysqli_num_rows($res);
 
while ($f = mysqli_fetch_array($res))
{
$situacaoo = $f["situacao"];
$id_situacaoo = $f["id_situacao"];
echo"<option value=\"$id_situacaoo\">$situacaoo</option>";
}
?>
  </select>
	</label>		





<label style = "margin-right:15px;" >
Site </br> 
 <input type="text" name="site"  size="30"  value = "<? echo $site ;?>"  class = "form-control animated  bounceInleft " placeholder="SITE" style="width:180px; margin-bottom:10px">
</label>



			<label style = "margin-right:15px;" >
Tipo de Empresa </br>  
            <select name="tipo" required class="form-control  animated  bounceInUp" placeholder="Situação" style="width:180px; margin-bottom:10px">

       

<?
 echo"<option value=\"$tipo\" selected>$tipo</option>";

$sql = "SELECT * FROM tab_tipodeempresa where tipo <> '$tipo'  ";
$res = mysqli_query($con, $sql);
$total = mysqli_num_rows($res);
 
while ($f = mysqli_fetch_array($res))
{
$tipoo = $f["tipo"];
echo"<option value=\"$tipoo\">$tipoo</option>";
}
?>
?>
  </select>
	</label>		

			
	
 </br></br>
     <input type="submit" name="buttom" class = "btn btn-success animated  bounceInright "  value="SALVAR" style="width:180px; margin-bottom:10px">
                 </div>
</form>
<p align="center">&nbsp;</p>
<p align="center"></p>
<?
 include"rodape.php";
?>

Zerion Mini Shell 1.0