HEX
Server: Apache
System: Linux pdx1-shared-a1-06 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: ednermusika (2886498)
PHP: 8.4.2
Disabled: NONE
Upload Files
File: /home/ednermusika/ednergranados.com/admin/usuario_cambios.php
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
?>
<?php require_once('../Connections/con_edner.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE usuario SET usu_correo=%s, usu_nombre=%s, usu_contrasena=%s, usu_rol=%s, usu_tipo=%s, usu_activo=%s WHERE usu_consecutivo=%s",
                       GetSQLValueString($_POST['usu_correo'], "text"),
                       GetSQLValueString($_POST['usu_nombre'], "text"),
                       GetSQLValueString($_POST['usu_contrasena'], "text"),
                       GetSQLValueString($_POST['usu_rol'], "text"),
                       GetSQLValueString($_POST['usu_tipo'], "text"),
                       GetSQLValueString($_POST['usu_activo'], "int"),
                       GetSQLValueString($_POST['usu_consecutivo'], "int"));

  mysql_select_db($database_con_edner, $con_edner);
  $Result1 = mysql_query($updateSQL, $con_edner) or die(mysql_error());

  $updateGoTo = "usuarios_admin.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$colname_usuarios = "-1";
if (isset($_GET['usu_consecutivo'])) {
  $colname_usuarios = $_GET['usu_consecutivo'];
}

mysql_select_db($database_con_edner, $con_edner);
$query_usuario = sprintf("SELECT usu_consecutivo, usu_correo, usu_nombre, usu_contrasena, usu_rol, usu_tipo, usu_activo FROM usuario WHERE usu_consecutivo = %s", GetSQLValueString($colname_usuarios, "int"));
$usuario = mysql_query($query_usuario, $con_edner) or die(mysql_error());
$row_usuario = mysql_fetch_assoc($usuario);
$totalRows_usuario = mysql_num_rows($usuario);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Usuarios (Modificar)</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><h1>Usuarios</h1></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><a href="usuario_admin.php" class="ligas_menu_interiores">&laquo;Regresar</a></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><hr class="hr_principal" /></td>
  </tr>
</table>
<blockquote>&nbsp;
  <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
    <table width="500">
      <tr valign="baseline">
        <td colspan="2" nowrap="nowrap"><h3>Modificar Usuario</h3></td>
      </tr>
      <tr valign="baseline">
        <td width="148" nowrap="nowrap"><h6>&nbsp;</h6></td>
        <td width="340"><input type="hidden" name="usu_consecutivo" value="<?php echo $row_usuario['usu_consecutivo']; ?>" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>Clave o correo:</h4></td>
        <td><input name="usu_correo" type="text" value="<?php echo $row_usuario['usu_correo']; ?>" size="40" maxlength="100" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>Nombre completo:</h4></td>
        <td><input name="usu_nombre" type="text" value="<?php echo $row_usuario['usu_nombre']; ?>" size="40" maxlength="100" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>Contrase&ntilde;a:</h4></td>
        <td><input name="usu_contrasena" type="text" value="<?php echo $row_usuario['usu_contrasena']; ?>" size="30" maxlength="20" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>Rol:</h4></td>
        <td><select name="usu_rol" id="usu_rol">
          <option value="0" <?php if (!(strcmp(0, $row_usuario['usu_rol']))) {echo "selected=\"selected\"";} ?>>Seleccione una opci&oacute;n...</option>
          <?php if ($_SESSION['ROL']=='SA')
          {?>
          <?php }?>
          <option value="ADMINISTRADOR" <?php if (!(strcmp("ADMINISTRADOR", $row_usuario['usu_rol']))) {echo "selected=\"selected\"";} ?>>ADMINISTRADOR</option>
        </select>        </td>
      </tr>
      
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>Activo:</h4></td>
        <td><select name="usu_activo" id="usu_activo">
          <option value="1" <?php if (!(strcmp(1, $row_usuario['usu_activo']))) {echo "selected=\"selected\"";} ?>>SI</option>
          <option value="0" <?php if (!(strcmp(0, $row_usuario['usu_activo']))) {echo "selected=\"selected\"";} ?>>NO</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h4>&nbsp;</h4></td>
        <td><input type="hidden" name="usu_tipo" value="<?php echo $row_usuario['usu_tipo']; ?>" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap"><h6>&nbsp;</h6></td>
        <td><input name="guardar" type="button" class="boton_panel" id="guardar" onclick="MM_callJS('f_enviar();')" value="Guardar" /> <input name="cancelar" type="button" class="boton_panel" id="cancelar" onclick="MM_callJS('history.back();')" value="Cancelar" /></td>
      </tr>
    </table>
    
    <input type="hidden" name="MM_update" value="form1" />
  </form>
  <p>&nbsp;</p>
</blockquote>
</body>
</html>
<script type="text/javascript">
function f_validar ( )
{
	var retorno = true;
	
	with ( document.form1 )
	{
		if ( usu_correo.value == '' )
		{
			alert               ( 'Por favor proporcione el correo del usuario' );
			usu_correo.focus    ( );
			retorno             = false;
		}
		else if ( usu_nombre.value == '' )
		{
			alert               ( 'Por favor proporcione el nombre del usuario' );
			usu_nombre.focus    	( );
			retorno             = false;
		}
		else if ( usu_contrasena.value == '' )
		{
			alert               ( 'Por favor proporcione la contraseƱa del usuario' );
			usu_contrasena.focus    	( );
			retorno             = false;
		}
		else if ( usu_rol.value == '0' )
		{
			alert               ( 'Por favor proporcione el rol del usuario' );
			usu_rol.focus    	( );
			retorno             = false;
		}
	}
	return retorno
}
function f_enviar()
{
	with (document.form1)
	{
		if ( f_validar ( ) )
		{
			submit ( );
		}
	}
}
</script>
<?php
mysql_free_result($usuario);
?>