File: /home/ednermusika/ednergranados.com/admin/galeria_detalle_cambios.php
<?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 galeria_detalle SET gal_consecutivo, gad_consecutivo, gal_id, gad_descripcion, gad_ruta, gad_thumbnail, gad_imagen, gad_orientacion, gad_activo FROM galeria_detalle WHERE gad_consecutivo = %s",
GetSQLValueString($_POST['gal_consecutivo'], "int"),
GetSQLValueString($_POST['gal_id'], "text"),
GetSQLValueString($_POST['gad_descripcion'], "text"),
GetSQLValueString($_POST['gad_ruta'], "text"),
GetSQLValueString($_POST['gad_thumbnail'], "text"),
GetSQLValueString($_POST['gad_imagen'], "text"),
GetSQLValueString($_POST['gad_orientacion'], "text"),
GetSQLValueString($_POST['gad_activo'], "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 = "galeria_detalle_admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_galeria = "-1";
if (isset($_GET['gal_consecutivo'])) {
$colname_galeria = $_GET['gal_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria = sprintf("SELECT gal_consecutivo, gal_titulo, gal_fecha, gal_ruta, gal_activo, CURDATE() as FECHA_HOY FROM galeria WHERE gal_consecutivo = %s", GetSQLValueString($colname_galeria, "int"));
$galeria = mysql_query($query_galeria, $con_edner) or die(mysql_error());
$row_galeria = mysql_fetch_assoc($galeria);
$totalRows_galeria = mysql_num_rows($galeria);
/*if ((isset($_POST['gal_consecutivo'])) && ($_POST['gad_consecutivo'] != "")) {
$deleteSQL = sprintf("DELETE FROM galeria_detalle WHERE gal_consecutivo=%s and gad_consecutivo=%s",
GetSQLValueString($_POST['gal_consecutivo'], "int"),
GetSQLValueString($_POST['gad_consecutivo'], "int"));
mysql_select_db($database_con_edner, $con_edner);
$Result1 = mysql_query($deleteSQL, $con_edner) or die(mysql_error());
//$deleteGoTo = "galeria_detalle_actualizar_id.php?eve_consecutivo=".$_POST['eve_consecutivo'];
$deleteGoTo = "galeria_detalle_admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_galeria = "-1";
if (isset($_GET['gal_consecutivo'])) {
$colname_galeria = $_GET['gal_consecutivo'];
}*/
mysql_select_db($database_con_edner, $con_edner);
$query_galeria = sprintf("SELECT gal_consecutivo, gal_titulo FROM galeria WHERE gal_consecutivo = %s", GetSQLValueString($colname_galeria, "int"));
$galeria = mysql_query($query_galeria, $con_edner) or die(mysql_error());
$row_galeria = mysql_fetch_assoc($galeria);
$totalRows_galeria = mysql_num_rows($galeria);
/*$colname_galeria_detalle = "-1";
if (isset($_GET['gal_consecutivo'])) {
$colname_galeria_detalle = $_GET['gal_consecutivo'];
}*/
$colname2_galeria_detalle = "-1";
if (isset($_GET['gad_consecutivo'])) {
$colname2_galeria_detalle = $_GET['gad_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria_detalle = sprintf("SELECT gal_consecutivo, gad_consecutivo, gad_descripcion, gad_ruta, gad_thumbnail, gad_imagen, gad_orientacion, gad_activo FROM galeria_detalle WHERE gal_consecutivo = %s and gad_consecutivo = %s", GetSQLValueString($colname_galeria_detalle, "int"),GetSQLValueString($colname2_galeria_detalle, "int"));
$galeria_detalle = mysql_query($query_galeria_detalle, $con_edner) or die(mysql_error());
$row_galeria_detalle = mysql_fetch_assoc($galeria_detalle);
$totalRows_galeria_detalle = mysql_num_rows($galeria_detalle);
?>
<!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>Fotos de <?php echo $row_galeria['gal_titulo']; ?></h1></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="galeria_detalle_admin.php?gal_consecutivo=<?php echo $row_galeria['gal_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="" method="POST" name="form1" id="form1">
<table width="639">
<tr valign="baseline">
<td colspan="2" nowrap="nowrap"><h3>¿Modificar foto?</h3></td>
</tr>
<tr valign="baseline">
<td width="125" align="right" nowrap="nowrap"><h4> </h4></td>
<td width="502"><input type="hidden" name="gal_consecutivo" value="<?php echo $row_galeria['gal_consecutivo']; ?>" size="32" />
<input type="hidden" name="gad_consecutivo" value="<?php echo $row_galeria_detalle['gad_consecutivo']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><h4>Descripción:</h4></td>
<td> <input name="gad_descripcion" type="text" value="<?php echo $row_galeria_detalle['gad_descripcion']; ?>" size="100" maxlength="200" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"> </td>
<td><img src="../<?php echo $row_galeria_detalle['gad_ruta'].$row_galeria_detalle['gad_imagen']; ?>" border="1" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4>Ruta:</h4></td>
<td><input name="gad_ruta" type="file" id="gad_ruta" value="<?php echo $row_galeria_detalle['gad_ruta'].$row_galeria_detalle['gad_imagen']; ?>"></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Activo:</h4></td>
<td><select name="gad_activo" id="gad_activo">
<option value="1" <?php if (!(strcmp(1, $row_galeria_detalle['gad_activo']))) {echo "selected=\"selected\"";} ?>>SI</option>
<option value="0" <?php if (!(strcmp(0, $row_galeria_detalle['gad_activo']))) {echo "selected=\"selected\"";} ?>>NO</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><h4> </h4></td>
<td><!--<input type="hidden" name="gad_ruta" value="<?php //echo $row_galeria_detalle['gad_ruta']; ?>" size="32" />-->
<input type="hidden" name="gad_thumbnail" value="<?php echo $row_galeria_detalle['gad_thumbnail']; ?>" size="32" />
<input type="hidden" name="gad_orientacion" value="<?php echo $row_galeria_detalle['gad_orientacion']; ?>" size="32" />
<input type="hidden" name="gal_id" value="<?php echo $row_galeria_detalle['gal_id']; ?>" size="32" />
<input type="hidden" name="gad_imagen" value="<?php echo $row_galeria_detalle['gad_imagen']; ?>" size="32" />
</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><h4> </h4></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> </p>
</blockquote>
</body>
</html>
<script type="text/javascript">
function f_validar ( )
{
var retorno = true;
with ( document.form1 )
{
return retorno
}
}
function f_enviar()
{
with (document.form1)
{
if ( f_validar ( ) )
{
submit ( );
}
}
}
</script>
<?php
mysql_free_result($galeria);
mysql_free_result($galeria_detalle);
?>