<?php
if (isset ($_SESSION['username'])){ } else{ echo"<script language='JavaScript' type='text/JavaScript'> location.href='../../html/inicia_session.html'</script>";}?>
<html>
<head>
<title></title>
<link href="../css/estilo.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/valform.js"> </script>
<style type="text/css">
<!--
.Estilo2 {color: #FF0000}
-->
</style>
<Script Language="JavaScript">
<!--
function mensaje()
{
window.alert("¡¡¡El Usuario ha sido Modificado Exitosamente!!!")
}
function mensaje3()
{
window.alert("¡¡¡El Usuario ha sido Insertado Exitosamente!!!")
}
function mensaje4()
{
window.alert("¡¡¡El Usuario ha sido Eliminado Exitosamente!!!")
}
function mensaje2()
{
window.alert("¡¡¡ Debe LLenar todos los Campos !!!")
}
//-->
</Script>
</head>
<body onLoad="JavaScript: document.formul.nombre_autoridad.focus();">
<?php if (isset($_POST['insertar'])) { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++
$post_passwd = $_POST['passwd'];
$post_nombre_completo = strtoupper($_POST['nombre_completo']);
if ($_POST['usuario'] <> "" and $_POST['passwd'] <> "" and $_POST['nombre_completo'] <> "" and $_POST['cedula'] <> "") {
include ("config.php");
if (!$con) {
}
if (!$db_selected) {
}
$consulta="insert into usuario (usuario, passwd, nombre_completo, cedula) values ('$post_usuario', '$post_passwd', '$post_nombre_completo', $post_cedula);";
$post_usuario = "";
$post_passwd = "";
$post_nombre_completo = "";
$post_cedula = ""; ?>
<Script Language="JavaScript"> mensaje3() </script>
<?php }
}//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++?>
<?php if (isset($_POST['modificar'])) { //******************************************
$post_passwd = $_POST['passwd'];
$post_nombre_completo = strtoupper($_POST['nombre_completo']);
if ($_POST['usuario'] <> "" and $_POST['passwd'] <> "" and $_POST['nombre_completo'] <> "" and $_POST['cedula'] <> "") {
include ("config.php");
if (!$con) {
}
if (!$db_selected) {
}
$consulta="update usuario set passwd = '$post_passwd', nombre_completo = '$post_nombre_completo', cedula = $post_cedula where usuario = '$post_usuario';";
$post_usuario = "";
$post_passwd = "";
$post_nombre_completo = "";
$post_cedula = ""; ?>
<Script Language="JavaScript"> mensaje() </script>
<?php }
}//*******************************************************************************?>
<?php if (isset($_POST['eliminar'])) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$post_passwd = $_POST['passwd'];
$post_nombre_completo = strtoupper($_POST['nombre_completo']);
if ($_POST['usuario'] <> "" and $_POST['nombre_completo'] <> "" and $_POST['cedula'] <> "") {
include ("config.php");
if (!$con) {
}
if (!$db_selected) {
}
$consulta="delete from usuario where usuario = '$post_usuario';";
$post_usuario = "";
$post_passwd = "";
$post_nombre_completo = "";
$post_cedula = ""; ?>
<Script Language="JavaScript"> mensaje4() </script>
<?php }
}//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?>
<?php if (isset($_POST['buscar'])) { //------------------------------------
$post_usuario_bus = strtoupper($_POST['usuario_bus']);
include ("config.php");
if (!$con) {
}
if (!$db_selected) {
}
$consulta1 = "Select * from usuario where usuario = '$post_usuario_bus'";
$post_passwd = $lafila1['passwd'];
$post_nombre_completo = strtoupper($lafila1['nombre_completo']);
}//-------------------------------------------------------------------- ?>
<form action="usuario.php" name="formul" method="post">
<script language="JavaScript">
var w = 400;
var h = 150;
resizeTo(w, h);
moveTo((screen.width - w)/ 2, (screen.height - h)/ 2);
</script>
<script language="JavaScript">
<!--
function asignarfoco()
{
if (document.formul.nombre_autoridad.value.length==60)
{
document.formul.nombre_autoridad.focus();
}
}
-->
</script>
<br>
<br>
<table width="80%" border="0" align="center" bordercolor="#0066FF" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" bgcolor="#0066FF" align="left">
<br>
<br>
<center>
<table border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#0066FF">
<tr>
<td colspan="2" class="primeralinea"><font color="#FFFFFF">SELECCIONAR USUARIO</font></td>
</tr>
<tr>
<td>USUARIO:</td>
<td>
<select name="usuario_bus">
<option selected>
<?php
include ("config.php");
if (!$con) {
}
if (!$db_selected) {
}
$consulta3 = "Select usuario from usuario where usuario <> 'USUARIO'";
do
{
?>
<option selected value="<?php echo $lafila3["usuario"] ?>"> <?php echo $lafila3["usuario"];
</select>
</font></td>
</tr>
<tr align="center">
<td colspan="2" bgcolor="#0066FF">
<center>
<br>
<input name="buscar" type="submit" value="Buscar">
</center>
</td>
</tr>
</table>
<br>
<br>
<br>
<br>
<br>
<table border="0" cellpadding="0" cellspacing="0" bordercolor="#0066FF">
<tr>
<td colspan="2" align="center" class="primeralinea">
<center>
<font color="#FFFFFF">USUARIO</font>
</center>
</td>
</tr>
<tr>
<td align="left">
USUARIO:
</td>
<td align="left">
<input type="text" name="usuario" size="45" maxlength="50" value = "<?php echo $post_usuario; ?>">
</td>
</tr>
<tr>
<td align="left"> CONTRASEÑA:</td>
<td align="left">
<input name="passwd" type="text" size="45" maxlength="50" value = "<?php echo $post_passwd; ?>">
</td>
</tr>
<tr>
<td colspan="2" align="center">
</td>
</tr>
<td align="left"> CEDULA:</td>
<td align="left">
<input name="cedula" type="text" size="45" maxlength="50" onKeyPress="return ValidarNumero(event);" value = "<?php echo $post_cedula; ?>">
</td>
</tr>
<tr>
<td colspan="2" align="center">
</td>
</tr>
<td align="left"> NOMBRE Y APELLIDO:</td>
<td align="left">
<input name="nombre_completo" type="text" size="45" maxlength="50" value = "<?php echo $post_nombre_completo; ?>">
</td>
</tr>
<tr>
<td colspan="2" align="center">
</td>
</tr>
<tr align="center">
<td colspan="2" bgcolor="#0066FF">
<center>
<br>
<input type="submit" value="Insertar" name = "insertar"> <input type="submit" name = "modificar" value="Modificar"> <input type="submit" value="Eliminar" name = "eliminar">
</center>
</td>
</tr>
</table>
<br>
<br>
<td width="50%" align="center">
<div align="center" class="Estilo1">
<strong><img src="../imagenes/usuarios.jpg" alt="SISREG" width="400" height="400"></strong>
</div>
<br>
</table>
</form>
</body>
</html>