<?php include('meta.php') ?>
<?php 
	$bg_header = "bg_hc"; 
	include('header.php');
	if ($_GET['newuser'] == 1){
	       		 echo "<div id='alert' class='alert alert-success'>Usuario creado <b>Gracias</b></div>";
	};
	if ($_GET['deluser'] == 1){
	       		 echo "<div id='alert' class='alert alert-success'>Usuario Eliminado <b>Gracias</b></div>";
	};
	if ($_GET['update'] == 1){
	       		 echo "<div id='alert' class='alert alert-success'>Datos actualizados <b>Gracias</b></div>";
	};
	if ($_GET['lockuser'] == 1){
	       		 echo "<div id='alert' class='alert alert-success'>Usuario bloqueado <b>Gracias</b></div>";
	};
?>
<script type='text/javascript'>
function same_pass() {
			var pass1 = document.getElementById('pass1').value;
			var pass2 = document.getElementById('pass2').value;
			if (pass1 != pass2) {
						alert('las contraseñas no son iguales');
			}
		};
function same_pass_update() {
			var pass3 = document.getElementById('pass3').value;
			var pass4 = document.getElementById('pass4').value;
			if (pass3 != pass4) {
						alert('la contraseña nueva no son iguales');
			}
		};
function confirm_del(x){
				if (confirm("Esta seguro de eliminar este usuario?") == true) {    
		        location.href='del_user.php?id='+x;
			    } else {
			    location.href='user.php';
			    }
		};
function confirm_lock(x){
				if (confirm("Esta seguro de bloquear este usuario?") == true) {    
		        location.href='lock_user.php?id='+x;
			    } else {
			    location.href='user.php';
			    }
		};
function confirm_unlock(x){
				if (confirm("Esta seguro de desbloquear este usuario?") == true) {    
		        location.href='unlock_user.php?id='+x;
			    } else {
			    location.href='user.php';
			    }
		}  		
</script>
	<div id="box_body"><!-- body center -->
			<span class="subtitle2">Opciones</span><div id="line"></div>
			<br>
			<!--  OPCIONES ADMIN -->
			<?php
		    if ($_SESSION['type_user_live'] == "Admin") {
		    	include('210742.php');
		    }
			?>			
			<?php
			$id = $_SESSION['userid'];
			$result = mysqli_query($con,"SELECT * FROM user WHERE id ='$id'");  
			$row = mysqli_fetch_assoc($result);
			$name = $row['name'];
			$username = $row['username'];
			$email = $row['email'];
			?>
			<div class="panel panel-default">
  				<div class="panel-heading"><strong>Edita tu Informacion:</strong></div>
  					<div class="panel-body"> 
  			<form action="update_user.php" method="POST">
  			<input type="hidden" name="id" value="<?php echo $id ?>">
  			<div id="tb_col" style="width: 45%">
  			  	<h4>Cambia tu información</h4>
  			  	<div id="line"></div><br>
  				<p>Nombres y Apellido: <input type="text" name="name" size="15" class="right" value="<?php echo $name ?>"></p>
				<p>Email: <input type="email" name="email" size="15" class="right" value="<?php echo $email ?>"></p>
  			</div>
  			<div id="tb_col" style="width: 8%"></div>
  			<div id="tb_col" style="width: 50%">
  				<h4>Cambia tu contraseña</h4>
  				<div id="line"></div><br>
				<p>Contraseña actual: <input type="password" name="password_actual" size="15" class="right" ></p>
				<p>Contraseña nueva: <input type="password" name="name2" id="pass3" size="15" class="right" ><br />
				<p>Repita la contraseña nueva:   &nbsp; <input type="password" name="password2" size="15" id="pass4" onblur="same_pass_update()"  class="right" ></p>
			</div>
			<br><div align="center"><input type="submit" name="Crear" value="Actualizar Información"></div>
			</form>						
					</div>
				</div>
			</div>
			
	</div><!-- END body center -->
</div> <!-- END BLOQUE CENTRAL -->
 <script type="text/javascript">
$(function () {
   $("#dialogContent").dialog({
     autoOpen: false,
     modal: true,
     height: 500,
  	 width: 500,
   	 resizable: true,
  	  title: 'Editar'
   });

   $('#dialog').click(function () {
     $("#dialogContent").dialog( "open" );
   });
 });
</script>  

<!-- 
<div id="dialogContent" title="Basic dialog">
  <iframe src="left.php" width="100%" height="100%" style="border:0px"></iframe>
</div>
<button id="dialog">Open Dialog</button>
-->

<?php include('footer.php') ?>


 
