File: /home/ednermusika/ednergranados.com/admin/galeriaaudios_detalle_cambios.php
<?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 galeria_audio_detalle SET gad_titulo=%s, gad_descripcion=%s, gad_autor=%s, gad_fecha=%s, gad_ruta=%s, gad_audio=%s, gad_activo=%s WHERE gaa_consecutivo=%s AND gad_consecutivo=%s",
GetSQLValueString($_POST['gad_titulo'], "text"),
GetSQLValueString($_POST['gad_descripcion'], "text"),
GetSQLValueString($_POST['gad_autor'], "text"),
GetSQLValueString($_POST['gad_fecha'], "date"),
GetSQLValueString($_POST['gad_ruta'], "text"),
GetSQLValueString($_POST['gad_audio'], "text"),
GetSQLValueString($_POST['gad_activo'], "int"),
GetSQLValueString($_POST['gaa_consecutivo'], "int"),
GetSQLValueString($_POST['gad_consecutivo'], "int"));
mysql_select_db($database_con_edner, $con_edner);
$Result1 = mysql_query($updateSQL, $con_edner) or die(mysql_error());
$updateGoTo = "galeriaaudios_detalle_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 = "")
{
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;
}
}
$colname_galeria_audio = "-1";
if (isset($_GET['gaa_consecutivo'])) {
$colname_galeria_audio = $_GET['gaa_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria_audio = sprintf("SELECT gaa_consecutivo, gaa_titulo FROM galeria_audio WHERE gaa_consecutivo = %s", GetSQLValueString($colname_galeria_audio, "int"));
$galeria_audio = mysql_query($query_galeria_audio, $con_edner) or die(mysql_error());
$row_galeria_audio = mysql_fetch_assoc($galeria_audio);
$totalRows_galeria_audio = mysql_num_rows($galeria_audio);
$colname_galeria_audios = "-1";
if (isset($_GET['gaa_consecutivo'])) {
$colname_galeria_audios = $_GET['gaa_consecutivo'];
}
$colname2_galeria_audios = "-1";
if (isset($_GET['gad_consecutivo'])) {
$colname2_galeria_audios = $_GET['gad_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria_audios = sprintf("SELECT gaa_consecutivo, gad_consecutivo, gad_titulo, gad_descripcion, gad_ruta, gad_audio, gad_activo, CURDATE() as FECHA_HOY FROM galeria_audio_detalle WHERE gaa_consecutivo = %s and gad_consecutivo = %s", GetSQLValueString($colname_galeria_audios, "int"),GetSQLValueString($colname2_galeria_audios, "int"));
$galeria_audios = mysql_query($query_galeria_audios, $con_edner) or die(mysql_error());
$row_galeria_audios = mysql_fetch_assoc($galeria_audios);
$totalRows_galeria_audios = mysql_num_rows($galeria_audios);
?>
<!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=iso-8859-1" />
<title>Untitled Document</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>Galería de audios de <?php echo $row_galeria_audio['gaa_titulo']; ?></h1></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="galeriaaudios_detalle_admin.php?gaa_consecutivo=<?php echo $row_galeria_audio['gaa_consecutivo']; ?>" class="ligas_menu_interiores">« Regresar</a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td><hr class="hr_principal" /></td>
</tr>
</table>
<blockquote>
<form action="galeriaaudios_detalle_guardar.php" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<table width="742">
<tr valign="baseline">
<td colspan="2" nowrap="nowrap"><h3>Modificar audio</h3> </td>
</tr>
<tr valign="baseline">
<td width="244" nowrap="nowrap" class="texto_14_verdana"> </td>
<td width="486"><input type="hidden" name="gaa_consecutivo" value="<?php echo $row_galeria_audios['gaa_consecutivo']; ?>" size="32" />
<input type="hidden" name="gad_consecutivo" value="<?php echo $row_galeria_audios['gad_consecutivo']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Título:</h4></td>
<td><input name="gad_titulo" type="text" id="gad_titulo" value="<?php echo $row_galeria_audios['gad_titulo']; ?>" size="50" maxlength="200" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Descripción corta:</h4></td>
<td><input name="gad_descripcion" type="text" value="<?php echo $row_galeria_audios['gad_descripcion']; ?>" size="50" maxlength="5000" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4>Ruta del Audio:</h4></td>
<td><input name="gad_audio" type="file" id="gad_audio" value=""></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4>Activo:</h4></td>
<td><select name="gad_activo" id="gad_activo">
<option value="1" <?php if (!(strcmp(1, $row_galeria_audios['gad_activo']))) {echo "selected=\"selected\"";} ?>>SI</option>
<option value="0" <?php if (!(strcmp(0, $row_galeria_audios['gad_activo']))) {echo "selected=\"selected\"";} ?>>NO</option>
</select></td>
</tr>
<tr valign="baseline">
<td colspan="2" nowrap="nowrap" class="texto_14_verdana"><p> </p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"> </td>
<td><input name="gad_audio_anterior" type="hidden" id="gad_audio_anterior" value="<?php echo $row_galeria_audios['gad_audio']; ?>" />
<input name="gad_autor" type="hidden" value="" />
<input type="hidden" name="gad_ruta" value="galeria_audios/" size="32" />
<span class="texto_14_verdana">
<input name="gad_fecha" type="hidden" id="gad_fecha" value="<?php echo $row_MAXIMO['FECHA_HOY']; ?>" size="32" />
</span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h6>
<input name="accion" type="hidden" id="accion" value="C" />
</h6></td>
<td><input name="guardar" type="button" class="boton_panel" id="guardar" onclick="MM_callJS('f_enviar();')" value="Guardar" />
<input name="limpiar" type="reset" class="boton_panel" id="limpiar" value="Limpiar" /></td>
</tr>
</table>
</form>
<p> </p>
</blockquote>
</body>
</html>
<?php
mysql_free_result($galeria_audio);
mysql_free_result($galeria_audios);
?>
<script type="text/javascript">
function f_validar ( )
{
var retorno = true;
with ( document.form1 )
{
if ( gad_titulo.value == '' )
{
alert ( 'Por favor proporcione el t�tulo' );
gad_titulo.focus ( );
retorno = false;
}
return retorno
}
}
function f_enviar()
{
with (document.form1)
{
if ( f_validar ( ) )
{
submit ( );
}
}
}
</script>