<?php
//	session_start();
    //Incluindo a conexão com banco de dados   
    include("config/conexao.php"); 
	include("cabecalho.php");
	$id = $_GET['id'];
	$empresa_id = $_SESSION['codCliente'];
	$sql  = "SELECT * FROM glpi_users u LEFT JOIN glpi_useremails um on u.id = um.users_id WHERE u.id = '{$id}' and u.empresa_id = '{$empresa_id}' "; //INNER JOIN glpi_useremails um on u.id = um.users_id 
	$res = mysqli_query($conn, $sql);	
	$row_rec = mysqli_fetch_array($res);
	$row = mysqli_num_rows($res);

       if ($row == 0){ ?>
                <script language="JavaScript" type="text/javascript"> alert ("Não é possível acessar a sua solicitação.")</script>
                <script language="JavaScript">window.location.href="../usuarios.php";</script>
        <?php } else {



?>

<!--<!DOCTYPE html>
<html lang="pt-br">

<head>
  <meta charset="utf-8">
  <title>Central de Atendimento</title>
  <meta name="author" content="">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/plugins/pace/pace.css" rel="stylesheet">
  <script src="js/pace/pace.js"></script>
  <link href="css/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href='css/fonts/google/fonte.css' rel="stylesheet" type="text/css">
  <link href="css/fonts/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="css/plugins/datatables/datatables.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">
</head>

<body>
  <div id="wrapper">
    <!-- INICIO MENU DE NAVEGAÇÃO -->
<!--			<nav class="navbar-top" role="navigation">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle pull-right" data-toggle="collapse" data-target=".sidebar-collapse">
						<i class="fa fa-bars"></i> Menu
					</button>
					<div class="navbar-brand">					
						<a href="index">
							<img src="img/adapter_bco.svg"   style="width: 70%;">
						</a>
					</div>
				</div>
				<div class="nav-top">
					<ul class="nav navbar-right">
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">		
								<i class="fa fa-user"></i>&nbsp&nbsp<?php echo $_SESSION['usuarioNome']; ?>&nbsp&nbsp<i class="fa fa-caret-down"></i>
							</a>		
							<ul class="dropdown-menu dropdown-user">
								<li>
									<a href="">
										<i class="fa fa-user"></i> Dados Pessoais
									</a>
								</li>
								<li>
									<a href="#" data-toggle="modal" data-target="#AlterarSenha">
										<i class="fa fa-gear"></i> Configurações
									</a>
								</li>
								<li class="divider"></li>
								<li>
									<a class="logout_open" href="logoff.php">
										<i class="fa fa-sign-out"></i> Sair
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</nav>
    <!-- FIM MENU DE NAVEGAÇÃO -->
    <div id="page-wrapper">
      <div class="page-content">
        <div class="row">
          <div class="col-lg-12">
            <div class="page-title">
              <ol class="breadcrumb">
                <li>
                  <i class="fa fa-home"></i> <a href="home.php">Home</a>
                </li>
				<li>
				  <i class="fa fa-user-circle-o"></i> <a href="usuarios.php">Usuários</a>	
				</li>
                <li class="active"><i class="fa fa-pencil-square-o"></i> Editar</li>
              </ol>
            </div>
          </div>
        </div>
        <div class="portlet portlet-default">
			<form  action="config/script_usuarios.php?acao=editar" method="POST" enctype="multipart/form-data">	
			  <div class="portlet-heading text-center">
				<div class="portlet-title">
				  <h4 >Editar Usuários</h4>
				</div>
				<div class="clearfix"></div>
			  </div>
			  <div class="portlet-body">
				  
						<div class= "row">
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>Nome Usuário:</b></label>
								  <input type="hidden" name="id_usuario" id="id_usuario" value="<?php echo $row_rec['id']; ?>" />
								  <input type="text" class="form-control" placeholder="Nome do usuário" name="usuario" id="usuario"  value="<?php echo $row_rec['firstname']; ?>" required="required" />
								</div>
							</div>
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>Sobre Nome:</b></label>
								  <input type="text" class="form-control" placeholder="Sobre do usuário" name="sobre_nome" id="sobre_nome" value="<?php echo $row_rec['realname']; ?>" required="required" />
								</div>
							</div>
						</div>
						<div class= "row">
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>Login:</b></label>
								  <input type="text" class="form-control" placeholder="Login do usuário" name="login" id="login" value="<?php echo $row_rec['name']; ?>" required="required" readonly />
								</div>
							</div>
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>Senha:</b></label>
								  <input type="password" class="form-control" placeholder="Senha do usuário" name="senha" id="senha" value="<?php echo $row_rec['password']; ?>" required="required" />
								</div>
							</div>
						</div>
						<div class= "row">
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>Confirmação de Senha:</b></label>
								  <input type="password" class="form-control" placeholder="Confirmação de Senha" name="csenha" id="csenha" value="<?php echo $row_rec['password']; ?>" required="required" />
								</div>
							</div>
							<div class="col-lg-6">
								<div class="form-group">
								  <label><b>E-MAIL:</b></label>
								  <input type="email" class="form-control" placeholder="Login do usuário" name="email" id="email" value="<?php echo $row_rec['email']; ?>" required="required" />
								</div>
							</div>
						</div>
						
				
			  </div> 
			  <div class="portlet-footer text-center">
				<a class="btn btn-default" href="usuarios.php">Cancelar</a>
				<button type="submit" id="SalvarUsuario" name="SalvarUsuario" onclick="return ValidarCadastro();" class="btn btn-green">
					<i class="fa fa-save"></i> Salvar
				</button>
			  </div> 
			</form>	  
        </div>
        <div class="row">
        </div>
      </div>
    </div>
  </div>

  <!-- -------------------------------------------------------------------------------------------------------------------------->
 

  <!-- -------------------------------------------------------------------------------------------------------------------------->

  <script src="js/jquery/jquery-1.8.1.js"></script>
  <script src="js/jquery/jquery.maskedinput.js"></script>
  <script src="js/jquery/jquery.cadastro.usuario.js"></script>
  <script src="js/bootstrap/bootstrap.min.js"></script>
  <script src="js/slimscroll/jquery.slimscroll.min.js"></script>
  <script src="js/popupoverlay/jquery.popupoverlay.js"></script>
  <script src="js/popupoverlay/defaults.js"></script>
  <script src="js/popupoverlay/logout.js"></script>
  <script src="js/hisrc/hisrc.js"></script>
  <script src="js/datatables/jquery.dataTables.js"></script>
  <script src="js/datatables/datatables-bs3.js"></script>
  <script src="js/jquery/jquery.Layout.js"></script>

</body>

</html>
<?php } ?>
