File: /home/ednermusika/ednergranados.com/admin/galeriavideos_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_video_detalle SET gvd_titulo=%s, gvd_descripcion=%s, gvd_autor=%s, gvd_fecha=%s, gvd_ruta=%s, gvd_rutahttp=%s, gvd_thumbnail=%s, gvd_video=%s, gvd_activo=%s WHERE gav_consecutivo=%s AND gvd_consecutivo=%s",
GetSQLValueString($_POST['gvd_titulo'], "text"),
GetSQLValueString($_POST['gvd_descripcion'], "text"),
GetSQLValueString($_POST['gvd_autor'], "text"),
GetSQLValueString($_POST['gvd_fecha'], "date"),
GetSQLValueString($_POST['gvd_ruta'], "text"),
GetSQLValueString($_POST['gvd_rutahttp'], "text"),
GetSQLValueString($_POST['gvd_thumbnail'], "text"),
GetSQLValueString($_POST['gvd_video'], "text"),
GetSQLValueString($_POST['gvd_activo'], "int"),
GetSQLValueString($_POST['gav_consecutivo'], "int"),
GetSQLValueString($_POST['gvd_consecutivo'], "int"));
mysql_select_db($database_con_edner, $con_edner);
$Result1 = mysql_query($updateSQL, $con_edner) or die(mysql_error());
$updateGoTo = "galeriavideos_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_video = "-1";
if (isset($_GET['gav_consecutivo'])) {
$colname_galeria_video = $_GET['gav_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria_video = sprintf("SELECT gav_consecutivo, gav_titulo FROM galeria_video WHERE gav_consecutivo = %s", GetSQLValueString($colname_galeria_video, "int"));
$galeria_video = mysql_query($query_galeria_video, $con_edner) or die(mysql_error());
$row_galeria_video = mysql_fetch_assoc($galeria_video);
$totalRows_galeria_video = mysql_num_rows($galeria_video);
$colname_galeria_videos = "-1";
if (isset($_GET['gav_consecutivo'])) {
$colname_galeria_videos = $_GET['gav_consecutivo'];
}
$colname2_galeria_videos = "-1";
if (isset($_GET['gvd_consecutivo'])) {
$colname2_galeria_videos = $_GET['gvd_consecutivo'];
}
mysql_select_db($database_con_edner, $con_edner);
$query_galeria_videos = sprintf("SELECT gav_consecutivo, gvd_consecutivo, gvd_titulo, gvd_descripcion, gvd_ruta, gvd_thumbnail, gvd_rutahttp, gvd_video, gvd_activo, CURDATE() as FECHA_HOY FROM galeria_video_detalle WHERE gav_consecutivo = %s and gvd_consecutivo = %s", GetSQLValueString($colname_galeria_videos, "int"),GetSQLValueString($colname2_galeria_videos, "int"));
$galeria_videos = mysql_query($query_galeria_videos, $con_edner) or die(mysql_error());
$row_galeria_videos = mysql_fetch_assoc($galeria_videos);
$totalRows_galeria_videos = mysql_num_rows($galeria_videos);
?>
<!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 Videos de <?php echo $row_galeria_video['gav_titulo']; ?></h1></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="galeriavideos_detalle_admin.php?gav_consecutivo=<?php echo $row_galeria_video['gav_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="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
<table width="742">
<tr valign="baseline">
<td colspan="2" nowrap="nowrap"><h3>Modificar video</h3> </td>
</tr>
<tr valign="baseline">
<td width="244" nowrap="nowrap" class="texto_14_verdana"> </td>
<td width="486"><input type="hidden" name="gav_consecutivo" value="<?php echo $row_galeria_videos['gav_consecutivo']; ?>" size="32" />
<input type="hidden" name="gvd_consecutivo" value="<?php echo $row_galeria_videos['gvd_consecutivo']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Título:</h4></td>
<td><input name="gvd_titulo" type="text" id="gvd_titulo" value="<?php echo $row_galeria_videos['gvd_titulo']; ?>" size="50" maxlength="200" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"><h4>Descripción corta:</h4></td>
<td><input name="gvd_descripcion" type="text" value="<?php echo $row_galeria_videos['gvd_descripcion']; ?>" size="50" maxlength="5000" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4>Ruta del Video:</h4></td>
<td><input name="gvd_rutahttp" type="text" id="gvd_rutahttp" value="<?php echo $row_galeria_videos['gvd_rutahttp']; ?>" size="50" /></td>
</tr>
<tr valign="baseline">
<td valign="top" nowrap="nowrap"><h4>Imagen del Video:<br />
Insertar <iframe></h4></td>
<td><label>
<textarea name="gvd_video" id="gvd_video" cols="45" rows="5"><?php echo $row_galeria_videos['gvd_video']; ?></textarea>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4>Activo:</h4></td>
<td><select name="gvd_activo" id="gvd_activo">
<option value="1" <?php if (!(strcmp(1, $row_galeria_videos['gvd_activo']))) {echo "selected=\"selected\"";} ?>>SI</option>
<option value="0" <?php if (!(strcmp(0, $row_galeria_videos['gvd_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="gvd_autor" type="hidden" value="" />
<input type="hidden" name="gvd_ruta" value="galeria_videos/" size="32" />
<span class="texto_14_verdana">
<input name="gvd_fecha" type="hidden" id="gvd_fecha" value="<?php echo $row_galeria_videos['FECHA_HOY']; ?>" size="32" />
</span>
<input name="gvd_thumbnail" type="hidden" value="tn_video.jpg" />
<input name="accion" type="hidden" id="accion" value="A" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" class="texto_14_verdana"><h4> </h4></td>
<td><input name="guardar" type="button" id="guardar" value="Guardar" onclick="f_enviar();"/>
<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>
<?php
mysql_free_result($galeria_video);
mysql_free_result($galeria_videos);
?>
<script type="text/javascript">
function f_validar ( )
{
var retorno = true;
with ( document.form1 )
{
if ( gvd_titulo.value == '' )
{
alert ( 'Por favor proporcione el t�tulo' );
gvd_titulo.focus ( );
retorno = false;
}
else if ( gvd_video.value == '' )
{
alert ( 'Por favor proporcione el video' );
gvd_video.focus ( );
retorno = false;
}
return retorno
}
}
function f_enviar()
{
with (document.form1)
{
if ( f_validar ( ) )
{
submit ( );
}
}
}
</script>